Uncaught ReferenceError: $ is not defined


#1

Is this a bug?


#2

Hi cermik,

That might be a bug! If you copy/paste your code somewhere else, click the Reset Code button (it's by the Save & Submit Code button), and paste your jQuery code back in, does that error go away?


#3

Hi,
I have the same issue. Clicking the Reset Code button doesn't seem to work, terribly. I have done some research, but I can not seem to find the source of the problem. Maybe there is another topic discussing this? I would appreciate any sort of resonse, thank you! :slightly_smiling:


#4

@simpanlimpan Could you please copy/paste the entire code from both your JavaScript and HTML files into here please?

Use backticks so that the code will be visible :slightly_smiling::


#5

Hi,
This is the html and the javascript code for the exercise. The jQuery seems to work sometimes and sometimes not depending on what computer I use.

<!DOCTYPE html>
<html>
    <head>
        <link rel="stylesheet" type="text/css" href="stylesheet.css"/>
        <script type="text/javascript" src="script.js"></script>
    </head>
    <body>
        <div id="red"></div>
        <div id="blue"></div>
        <div id="yellow"></div>
        <div id="green"></div>
    </body>
</html>`

Javascript:

$(document).ready(function() {
   $('div').mouseenter(function() {
       $(this).animate({
           height: '+=10px'
       });
   });
   $('div').mouseleave(function() {
       $(this).animate({
           height: '-=10px'
       }); 
   });
   $('div').click(function() {
       $(this).toggle(1000);
   }); 
});

#6

@simpanlimpan Thanks!

Are you using the same browser and browser extensions across all of the computers?