Announcement

Collapse
No announcement yet.

trying to install and get jQuery to work...

Collapse
X
  • Filter
  • Time
  • Show
Clear All
new posts

  • trying to install and get jQuery to work...

    I want to play around with some jQuery, but I can't get anything to work. I must be missing something somewhere...I posted my test page below. When I click the link it should fade the red box out, but nothing happens. I don't get any errors in Firebug and I know my path to the javascript file is correct. Any ideas?

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml">
    <head>
    <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />
    <meta name="subject" content="" />
    <meta name="Description" content="" />
    <meta name="Keywords" content="" />
    <title></title>
    <link href="xxx.css" rel="stylesheet" type="text/css" media="screen"/>
    <link rel="icon" href="favicon.ico" type="image/x-icon" />
    <link rel="shortcut icon" href="favicon.ico" type="image/x-icon" />
    <script src="http://www.site.com/js/jquery-1.3.2.min.js" type="text/javascript"></script>

    <style type="text/css">

    #box {background-color: red; width: 300px; height: 300px;}

    </style>

    <script type="text/javascript">
    $(function() {
    $('a').click(function() {
    $('#box').fadeOut();
    });
    });

    </script>


    </head>

    <body>

    <div id="box">

    </div>
    <a href="">fade Out</a>

    </body>

    </html>

  • #2
    haha wow, find out the problem....I added a "#" into the link href and it worked...

    <div id="box">

    </div>
    <a href="#">fade Out</a>

    Comment


    • #3
      Two quick things:
      1)You should link to jQuery like this:
      Code:
      <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.3.2/jquery.min.js"></script>
      That way it's possible the user will have it cached.

      2) you should add return false to the end of any link function that doesn't activate a link
      Code:
      $('a').click(function() {
      $('#box').fadeOut();
      return false;
      });
      This makes sure that the link is not activated by the browser.
      Swedish Meatball Pornography

      Comment

      Search

      Collapse

      Sponsor

      Collapse

      Incredible Stock

      Latest Topics

      Collapse

      • SpeccialK
        Feedback Appreciated
        SpeccialK
        I created my first signature in 12 years of not touching Photoshop or any graphics program in general. What do you guys think?
        Yesterday, 08:08 PM
      • SpeccialK
        Reply to Help with Photoshop
        SpeccialK
        Thank you for the help, I appreciate it!
        Yesterday, 04:32 PM
      • PrintDriver
        Comment on Need a little help on getting set up with a job.
        PrintDriver
        Oh, I wouldn't go so far as to say ''never use it for wide format.''
        It gets used all the time for some very very large things. I recently did a 16' x 87' backdrop built in Photoshop. It was printed...
        Yesterday, 03:03 PM
      • praxis11
        Reply to Would like critique of my site.
        praxis11
        Generally like it a lot. Pretty different and that's cool.

        Was thinking that I might like it better if I didn't have to click on the icons, that content would appear as you scroll down....
        Yesterday, 02:45 PM
      • Sbower
        Comment on COLOR ISSUES!
        Sbower
        Yeah, I have noticed they aren't as rich as I would like them to be. Luckily it seems like most of her stuff is going to be about online anyway. Thanks for the advice!
        Yesterday, 02:29 PM
      GDF A division of Mediabistro Holdings Adweek | Mediabistro | Clio | Film Expo Group Contact Us | Terms of Use | Privacy Policy Copyright 2016 Mediabistro Holdings
      Working...
      X