I have written a script with jQuery. It works with Firefox and GoogleChrome. Only with IE I have this error returned:
'jQuery' is not defined jquery-ui-1.8.4.custom.min.js, Row 10 Character 1
This is the head of my page:
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Contattaci - TheItalianBrand.com</title>
<script type="text/javascript" src="lib/jquery.js"></script>
<script type="text/javascript" src="lib/js/jquery-ui-1.8.4.custom.min.js"></script>
<link type="text/css" href="lib/css/smoothness/jquery-ui-1.8.4.custom.css" rel="stylesheet" />
<script type="application/javascript">
$(function(){
$('#dialog_link, ul#icons li').hover(
function() { $(this).addClass('ui-state-hover'); },
function() { $(this).removeClass('ui-state-hover'); }
);
$('input').change(function() {
validate();
});
$('input').keydown(function() {
validate();
});
$('textarea').change(function() {
validate();
});
$('textarea').keydown(function() {
validate();
});
});
</script>
</head>
What can I do?
jQuery is not defined” is a common WordPress error that occurs when a website calls for a jQuery function before the library properly loads. Possible causes include conflicting plugins, a corrupted jQuery file, a blocked CDN, or your JavaScript code loads incorrectly.”
You may experience the “jQuery is not defined error” when jQuery is included but not loaded. Make sure that it's loaded by finding the script source and pasting the URL in a new browser or tab. The snippet of text you should look for to find the URL to test.
To solve this error:Load the jQuery library at the beginning of all your javascript files/scripts which uses $ or jQuery, so that $ can be identified in scripts .
You're importing the jQuery UI library from lib/js
, but jQuery itself from lib
. I suspect that your copy of the jQuery library is also in lib/js
and that you're just not getting it due to that incorrect path. Of course, that would mean that it's not actually working in Firefox or Chrome or any other browser, but it could be that they're just less strident about error reporting so you're not noticing.
The Firefox "TamperData" plugin is really handy for tracking HTTP requests on page loads.
You have to check sequence of added jQuery, and adding jQuery library in proper sequence
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With