1. basically you weren't linking to the jquery library correctly - either the file wasn't in the location specified in the link or the filename/folder structure was incorrect. linking to the google APIs version of jquery just means you don't need to worry about the location of the file for now. the google servers are relatively nippy so it's unlikely to take a huge loadtime hit either - for some of our clients who insist on hosting a site on their own rubbish servers it's often faster to link out to the google ones.
2. it's just the shorthand way of doing document.ready, it does the same thing. On May 20, 1:33 pm, Kerry <vkerrysi...@gmail.com> wrote: > Hey thanks! That works perfectly! You are truly heaven sent!! > > 1)But I'm confused, why should i have to link to google(specified in > the src), as jquery.com provides the jquery-1.3.2.min.js download, > which you are supposed to link in your webpage? > As really what i'll be interested in using later on is the tablesorter > plugin, to be able to resort a table by clicking on a header in a > column. In this case would the link above suffice or would i have to > download and include the plugin : > <script src="jquery.tablesorter.js"></script> > > 2) in their example(http://docs.jquery.com/ > Tutorials:Getting_Started_with_jQuery#Hello_jQuery), they start their > function with $(document)... whereas you just did $(function).. whats > the difference? Although both ways work now. > > On May 20, 12:24 pm, "ryan.j" <ryan.joyce...@googlemail.com> wrote: > > > try... > > > $(function() { > > $("a").click(function () { > > $("#box").fadeOut(); > > }); > > }); > > > also, you're not linking the jquery lib sucessfully. replace ... > > > <script type="text/javascript" src="jquery-1.3.2.min.js"></script> > > > ... with ... > > > <script type="text/javascript" src="http://ajax.googleapis.com/ajax/ > > libs/jquery/1.3.1/jquery.min.js"></script> > > > On May 20, 11:23 am, Kerry <vkerrysi...@gmail.com> wrote: > > > > Hi I'm new to Jquery and trying a simple example before I start > > > working with it. Can someone please help me understand why the > > > following is not working. Firebug repport '$ is not defined'. > > > jquery-1.3.2.min.js is in the same directory as the web page as well. > > > > <head> > > > <meta http-equiv="Content-Type" content="text/html; > > > charset=ISO-8859-1"> > > > <script type="text/javascript" src="jquery-1.3.2.min.js"></script> > > > <style type="text/css"> > > > #box > > > { > > > background:red; > > > width:80px; > > > height:80px; > > > } > > > </style> > > > > <script type="text/javascript"> > > > $(document).ready(function(){ > > > $('a.box').click(function() { > > > $('#box').fadeOut(); > > > }); > > > }); > > > > </script> > > > > <title>Test</title> > > > </head> > > > <body> > > > <div id="box"></div> > > > <a href="#" >Link</a> > > > > </body> > > > </html>