1

I'm beginer at jQuery. I tried to do easy example but this doesn't work.
Show some errors:

Uncaught ReferenceError: $ is not defined => $(document).ready(function() {

Failed to load resource

I guess that I missed something but can't understand what it is.

Code:

<!DOCTYPE html>

<html><head> <title>jQuery goes to DOM-ville</title>
        <style>
            #change_me {
            position: absolute;
            top: 100px;
            left: 400px;
            font: 24px arial;}

            #move_up #move_down #color #disappear {
            padding: 5px;}
        </style>
        <script src="scripts/jquery-1.6.2.min.js"></script>
    </head>
    <body>
        <button id="move_up">Move Up</button>
        <button id="move_down">Move Down</button>
        <button id="color">Change Color</button>
        <button id="disappear">Disappear/Re-appear</button>
        <div id="change_me">Make Me Do Stuff!</div>
        <script>
            $(document).ready(function() {
                    $("#move_up").click( function() {
                        $("#change_me").animate({top:30},200);
                });//end move_up
                $("#move_down").click( function() {
                    $("#change_me").animate({top:500},2000);
                });//end move_down
                $("#color").click( function() {
                    $("#change_me").css("color", "purple");
                });//end color
                $("#disappear").click( function() {
                    $("#change_me").toggle("slow");
                });//end disappear
            });//end doc ready
        </script>
    </body>
</html>

Question:

  • How to solve this trouble?
Aleksandr M
  • 23,647
  • 12
  • 63
  • 129

1 Answers1

0

1) check the view page source from browser by right click and check jquery file is attached

2) or other way check from browser's console panel that file is attached

3) it also occurs when you haven't mentioned the right path in the src attribute

M Khalid Junaid
  • 60,231
  • 8
  • 78
  • 110