Javascript Runtime error: $ is undefined

I have added script in my Default.aspx page. I am getting following error.
Error

Answers:

Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.

Method 1

$ is defined by jQuery, which you probably haven’t referenced. A simple way to get it is to add one of the CDN urls to your template HTML:

<script src="https://code.jquery.com/jquery-1.10.1.min.js"></script>

Method 2

You need to include jQuery: http://learn.jquery.com/about-jquery/how-jquery-works/

<!doctype html>
<html>
<head>
    <meta charset="utf-8" />
    <title>Demo</title>
    **<script src="jquery.js"></script>**
</head>
<body>
  ...
</body>
</html>

Method 3

I had the same problem, but did have a correct reference to jQuery.

I solved it by referencing jQuery before any other scripts. In your case, it would look like this:

<script src= "scripts/jquery-ui.js" />
<script src= "scripts/JavaScript_scroll.js" />

Hope this helps anyone else with a similar issue.

Method 4

I had the Same Problem as that $ is Unidentified, After a long struggle, I come to know that there is some thing HTML coder error in Master Page, So it worked fine when i include the Jquery files directly in Content pageenter image description here

Method 5

(For others who may face the same problem as OP’s)
I had the same problem, but the reason was that I was trying to load my jQuery script before loading the jQuery library itself. In other words, make sure that you first add this line:

<script src="Scripts/jquery-{version}.min.js"></script>

before adding

<script src="Scripts/JavaSript_scroll.js"></script>


All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0

0 0 votes
Article Rating
Subscribe
Notify of
guest

0 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x