treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Something here must be wrong...

  • This is my link to jquery file -
    <script type=\"text/javascript\" src='http://ajax.googleapis.com/libs/jquery/1.3.2/jquery.min.js?ver=1.3.2'></script>


    This is the test i am trying -

    <script type=\"text/javascript\">     		   

    $(function() {
    $('a').click(function() {
    alert(\"Hello world!\");
    });
    });

    </script>


    This is the html that is required -
    <a href=\"#\">Click Me</a>


    Why won't it work - i really cant see the problem, i have tried hosting my own version of a jquery file but that did not work either.

    Please Help
    Many Thanks for your time
    Chris
  • you need

    <script type=\"text/javascript\">              
    $(document).ready(function() {
    $('a').click(function() {
    alert(\"Hello world!\");
    });
    });
    </script>


    jQuery needs the $(document).ready function.
  • Thanks for the reply - i'm not sure it does need that line - i got this code from one of the videos on themforest (the links at the start of this forum).
    I did put in your code just to check but it still will not work.

    Many Thanks
    Chris
  • Thanks - it works now. =-)