Hirvesh
Hirvesh

Reputation: 7982

JQuery Issue - Not Working!

Ok, I've got this code:

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
        <script type="text/javascript" href="https://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>
        <title>JQuery Demo 1</title>
        <style type="text/css">
            #box
            {
                background-color: #ff0000;
            }
        </style>
        <script type="text/javascript">
            $(function(){
                $('a').click(function()
                {
                    $('#box').fadeOut();
                });
            });
        </script>
    </head>
    <body>
        <div id="box">Yes!</div>
        <a href="#">Click me!</a>   
    </body>
</html>

I'm following this from the video tutorial series here. It's the first one in the series. (http://blog.themeforest.net/tutorials/jquery-for-absolute-beginners-video-series/)

When I execute this, Firebug says error

$ is not defined [Break On This Error] $(function(){

In the tut, it works ok. Any help, appreciated.

Upvotes: -1

Views: 100

Answers (2)

Matt Healy
Matt Healy

Reputation: 18531

Change

<script type="text/javascript" href="https://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>

to

 <script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>

Upvotes: 0

kieran
kieran

Reputation: 2312

Change href to src in your jquery script tag (line 4)...

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.2.6/jquery.min.js"></script>

Upvotes: 3

Related Questions