Well I tried that, and sad to say but the }); was in there. Am I not calling the jquery library properly? Does jquery have a problem the html doc I have at the top of my code?
Thanks a lot for your help On Jan 28, 9:32 pm, Karl Swedberg <k...@englishrules.com> wrote: > Hi there, > > Looks like you're missing a line. Try this: > > $(document).ready(function(){ > $("a").click(function(event){ > alert("Thanks for visiting!"); > event.preventDefault(); > }); // <-- you were missing this one. > > }); > > Try it here: > > http://test.learningjquery.com/click.html > > --Karl > > ____________ > Karl Swedbergwww.englishrules.comwww.learningjquery.com > > On Jan 28, 2009, at 5:33 PM, surreal5335 wrote: > > > > > I am just starting into jquery and I ham having the hardest trying to > > get anything to happen with my code. I have tried several tutorials, > > copied and pasted and still nothing happens. What am I missing? > > > The current code I am trying to get to work is: > > > <html> > > <!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"> > > > <title></title> > > <head> > > <script src="traffic/jquery-doc.js" type="text/javascript></script> > > > <script type="text/javascript"> > > > $(document).ready(function(){ > > > $("a").click(function(event){ > > alert("Thanks for visiting!"); > > event.preventDefault(); > > > }); > > > }); > > > </script> > > </head> > > <body> > > <a href="http://jquery.com/">jQuery</a> > > </body> > > </html> > > > The <script src="traffic/jquery-doc.js" type="text/javascript></ > > script> is calling jquery pack 1.3.1 or the latest one available. I > > have downloaded it and uploaded it to my web site then renamed it to > > "jquery-doc.js" > > > Supposedly the event.preventDefault(); is meant to prevent the > > default event of linking to jquery from happening, but it doesnt. The > > alert that is suppose to pop up is not happening either. So what am I > > missing? > > > Thanks a lot