You missed a bit of the instruction ...  where it says "In the ready function
(from the example above), add the following:".

So your script should look like this :

    <script type="text/javascript">
      $(document).ready(function(){
          $("a").click(function(){
             alert("Thanks for visiting!");
          });
        });
    </script>

...in other words, where the example had "// your code here", that's exactly
what it meant.


elvisparsley-2 wrote:
> 
> 
> I just started learning jQuery. Could any one help me?
> 
> I was following the jQuery tutorial, and the first one does not work.
> It is supposed to come up alert with Thanks fo visiting!. But it just
> go to a website without alert.
> 
> 
>  <html>
>   <head>
>     <script type="text/javascript" src="jquery-1.2.1.js"></script>
>     <script type="text/javascript">
>       // Your code goes here
>         $("a").click(function(){
>    alert("Thanks for visiting!");
>  });
>     </script>
>   </head>
>   <body>
>      http://jquery.com/ jQuery 
>   </body>
>   </html>
> 
> 
> 

-- 
View this message in context: 
http://www.nabble.com/Alert-not-working-tf4569739s27240.html#a13056253
Sent from the jQuery General Discussion mailing list archive at Nabble.com.

Reply via email to