开发者

JQuery Issue - Not Working!

开发者 https://www.devze.com 2023-02-08 19:48 出处:网络
Ok, I\'ve got this code: <html> <head> <meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">

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 开发者_如何学JAVAhelp, appreciated.


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>


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>
0

精彩评论

暂无评论...
验证码 换一张
取 消