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

      Advertisement

      Collapse

      Latest Topics

      Collapse

      • salsa
        Reply to Graphic Designer's In Math
        salsa
        What kind of simple math do you use on a regular basis whilst doing your job?
        addition, subtraction, multiplication, division, fractions & percentages, ratios, geometry, basic algebra, patterns/sequences...
        Today, 05:31 PM
      • PanToshi
        Reply to Anyone w/Experience Working at a Design Agency?
        PanToshi
        In my area of the country, there are an abundance of this.

        Believe me, despite over 12 years of agency experience and 15 years being a ''freelancer'', even I have encountered this bias. Especially...
        Today, 03:10 PM
      • B
        Reply to Anyone w/Experience Working at a Design Agency?
        B
        I wouldn't say it means nothing. If it's coupled with all the other things, like internships, actual employment and education, it definitely counts for something.

        When I interview people...
        Today, 02:33 PM
      • B
        Reply to Graphic Designer's In Math
        B
        Looks like I'm going to be the oddball here and say that I rarely need any math beyond basic arithmetic to do my job. The most math-intensive, graphic design thing I run into is figuring percentages,...
        Today, 02:24 PM
      • PrintDriver
        Reply to Email setup for multiple addresses - best practices
        PrintDriver
        Don't assume they are downloading. Depending on how your mail is set up, it may only be accessing and cataloging from your email server.
        Where I work, on the mac with an IMAP account, you have to...
        Today, 01:53 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