Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Error: 'jQuery is not defined'

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?

like image 951
michele Avatar asked Aug 28 '10 12:08

michele


People also ask

Is not defined issue in jQuery?

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.”

Why function is not defined in jQuery?

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.

How do you fix is not defined JavaScript?

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 .


2 Answers

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.

like image 89
Pointy Avatar answered Sep 18 '22 19:09

Pointy


You have to check sequence of added jQuery, and adding jQuery library in proper sequence

like image 41
Sagar Avatar answered Sep 22 '22 19:09

Sagar