Signup/Sign In
Ask Question
Not satisfied by the Answer? Still looking for a better solution?

Uncaught ReferenceError: $ is not defined? error in JavaScript

How come this code throws an

Uncaught ReferenceError: $ is not defined

when it was OK before?

$(document).ready(function() {
$('#tabs > ul').tabs({ fx: { opacity: 'toggle' } });
$('#featuredvid > ul').tabs();
});
Results in tabs don't close anymore.

jQuery is referenced in the header:

<script language="JavaScript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/js/sprinkle.js"></script>
<script language="JavaScript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/js/jquery-1.2.6.min.js"></script>
<script language="JavaScript" type="text/javascript" src="<?php echo get_option('siteurl') ?>/js/jquery-ui-personalized-1.5.2.packed.js"></script>
by

3 Answers

Kajalsi45d
In my case I was putting my .js file before the jQuery script link, putting the .js file after the jQuery script link solved my issue.


<script src=" ://code.jquery.com/jquery-1.10.2.js"></script>
<script src=" ://code.jquery.com/ui/1.11.2/jquery-ui.js"></script>
<script src=" ://maxcdn.bootstrapcdn.com/bootstrap/3.2.0/js/bootstrap.min.js"></script>
<script src="exponential.js"></script>
sandhya6gczb
This error occurs when there is a problem in loading jquery files .
The reasons maybe
JQuery plugins are included before the jQuery file. so always include the jquery.js file before jquery plugins.

<script src="/lib/jquery.min.js"></script>
<script src="/lib/jquery.plugin.js"></script>


The second reason can be the incorrect path used in jQuery. So check the path used in JQuery.
pankajshivnani123
You should put the references to the jquery scripts first.

<script language="JavaScript" type="text/javascript" src="/js/jquery-1.2.6.min.js"></script>
<script language="JavaScript" type="text/javascript" src="/js/jquery-ui-personalized-1.5.2.packed.js"></script>
<script language="JavaScript" type="text/javascript" src="/js/sprinkle.js"></script>

Login / Signup to Answer the Question.