13

Possible Duplicate:
ReferenceError: Can’t find variable: $

I get this error:

ReferenceError: Can't find variable: $

Any ideas?

Community
  • 1
  • 1
none
  • 235
  • 1
  • 2
  • 12

2 Answers2

12

Is the jquery javascript file loaded before you call anything with it -> using the selector $? Please check with Chrome or Firefox+firebug if the jquery library is loaded correctly. Maybe the path could be not correct

After that, try to place your code into:

$(document).ready(function() {
  // put all your jQuery goodness in here.
});

This will make sure that '// put all your jQuery goodness in here.' will be executed after jQuery has been loaded.

RvdK
  • 19,580
  • 4
  • 64
  • 107
  • 8
    Well, OP accepted the answer, but how would it help a ReferenceError that can't find `$`? Your code *uses* `$` to set up the `.ready()`. – user113716 Feb 03 '11 at 16:56
  • 1
    correct, I added extra info that the user first has to make sure jquery is loaded at all. So check if the path is correct. – RvdK Feb 03 '11 at 17:02
  • Given that the `jQuery` library is properly loaded and that all the jQuery code is placed after the content (right before `

    ` tag) the document ready function is unnecessary.

    – Wallace Sidhrée Sep 10 '13 at 17:59
7

wrong url in <script> for jQuery ?

Bobo
  • 595
  • 5
  • 18