[jQuery] Re: jQuery introduction script (Alert Message is now showing!)
Hi,sorry but this code isnt doing what its suppose to. No Pop up message On Apr 3, 6:47 am, "Mohd.Tareq" wrote: > On Fri, Apr 3, 2009 at 5:52 AM, yrstruly wrote: > > > Hallo > > > Im new to jQuery. I have donwloaded the jquery-1.3.2min file and i > > have copied that introduction code from the website and saved it in > > the same directory as the jquery file. When i run the script it seems > > to be working and when i click on the link it goes to the website, but > > isnt this script suppose to show an alert message first, before it > > goes to the website? > > > Please what am i doing wrong? Have a saved it correctly or is the file > > i donwloaded not valid? Please help. The code follows: > > > > > > > > > > > > > > > > $(document).ready(function(){ > > $("a").click(function(event){ > > alert("Thanks for visiting!"); > > }); > > }); > > > > > > > > > http://jquery.com/";>jQuery > > > > > > === ===Go for this script you can see now ur > click function will execute first & then it will go for link > > > > > > > > > $(document).ready(function(){ > $("a").click(function(event){ > window.href="http://jquery.com/";; <http://jquery.com/> > alert("Thanks for visiting!"); > return true; > }); > }); > > > > > http://jquery.com/>">jQuery > > > > cheers. > > Ragx
[jQuery] Re: jQuery introduction script (Alert Message is now showing!)
yrstruly, I replaced the DOCTYPE and html begin tag with this statement in order to keep browsers from entering quirks-mode. You original code worked fine in most of my browser tests except for IE8 RC. http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> http://www.w3.org/1999/xhtml"; xml:lang="en" lang="en"> You might consider using IETester to verify which versions of IE your scripts work with, http://www.my-debugbar.com/wiki/IETester/HomePage. Hope this helped. Chuck Wagner Subject: [jQuery] jQuery introduction script (Alert Message is now showing!) Hallo Im new to jQuery. I have donwloaded the jquery-1.3.2min file and i have copied that introduction code from the website and saved it in the same directory as the jquery file. When i run the script it seems to be working and when i click on the link it goes to the website, but isnt this script suppose to show an alert message first, before it goes to the website? Please what am i doing wrong? Have a saved it correctly or is the file i donwloaded not valid? Please help. The code follows: $(document).ready(function(){ $("a").click(function(event){ alert("Thanks for visiting!"); }); }); http://jquery.com/";>jQuery
[jQuery] Re: jQuery introduction script (Alert Message is now showing!)
I think the OP does want it to follow the link, but show the alert first ? So "return false" is not required. OP - make sure jQuery is loading (there's no error if it doesn't). Try just an alert message within $(document).ready() itself. Steve wrote: Hi, You need to return false so the anchor tag does not behave in its normal way (ie, take you to the link specified). So this should work: $("a").click(function(event){ alert("Thanks for visiting!"); return false; }); On Apr 2, 9:47 pm, "Mohd.Tareq" wrote: On Fri, Apr 3, 2009 at 5:52 AM, yrstruly wrote: Hallo Im new to jQuery. I have donwloaded the jquery-1.3.2min file and i have copied that introduction code from the website and saved it in the same directory as the jquery file. When i run the script it seems to be working and when i click on the link it goes to the website, but isnt this script suppose to show an alert message first, before it goes to the website? Please what am i doing wrong? Have a saved it correctly or is the file i donwloaded not valid? Please help. The code follows:$(document).ready(function(){ $("a").click(function(event){ alert("Thanks for visiting!"); }); });http://jquery.com/";>jQuery === ===Go for this script you can see now ur click function will execute first & then it will go for link $(document).ready(function(){ $("a").click(function(event){ window.href="http://jquery.com/";; <http://jquery.com/> alert("Thanks for visiting!"); return true; }); }); http://jquery.com/>">jQuery cheers. Ragx No virus found in this incoming message. Checked by AVG - www.avg.com Version: 8.0.238 / Virus Database: 270.11.40/2039 - Release Date: 04/03/09 06:19:00
[jQuery] Re: jQuery introduction script (Alert Message is now showing!)
Hi, You need to return false so the anchor tag does not behave in its normal way (ie, take you to the link specified). So this should work: $("a").click(function(event){ alert("Thanks for visiting!"); return false; }); On Apr 2, 9:47 pm, "Mohd.Tareq" wrote: > On Fri, Apr 3, 2009 at 5:52 AM, yrstruly wrote: > > > Hallo > > > Im new to jQuery. I have donwloaded the jquery-1.3.2min file and i > > have copied that introduction code from the website and saved it in > > the same directory as the jquery file. When i run the script it seems > > to be working and when i click on the link it goes to the website, but > > isnt this script suppose to show an alert message first, before it > > goes to the website? > > > Please what am i doing wrong? Have a saved it correctly or is the file > > i donwloaded not valid? Please help. The code follows: > > > > > > > > > > > > > > > > $(document).ready(function(){ > > $("a").click(function(event){ > > alert("Thanks for visiting!"); > > }); > > }); > > > > > > > > > http://jquery.com/";>jQuery > > > > > > === ===Go for this script you can see now ur > click function will execute first & then it will go for link > > > > > > > > > $(document).ready(function(){ > $("a").click(function(event){ > window.href="http://jquery.com/";; <http://jquery.com/> > alert("Thanks for visiting!"); > return true; > }); > }); > > > > > http://jquery.com/>">jQuery > > > > cheers. > > Ragx
[jQuery] Re: jQuery introduction script (Alert Message is now showing!)
On Fri, Apr 3, 2009 at 5:52 AM, yrstruly wrote: > > Hallo > > Im new to jQuery. I have donwloaded the jquery-1.3.2min file and i > have copied that introduction code from the website and saved it in > the same directory as the jquery file. When i run the script it seems > to be working and when i click on the link it goes to the website, but > isnt this script suppose to show an alert message first, before it > goes to the website? > > Please what am i doing wrong? Have a saved it correctly or is the file > i donwloaded not valid? Please help. The code follows: > > > > > > > > > >$(document).ready(function(){ > $("a").click(function(event){ > alert("Thanks for visiting!"); > }); > }); > > > > > > http://jquery.com/";>jQuery > > > === ===Go for this script you can see now ur click function will execute first & then it will go for link $(document).ready(function(){ $("a").click(function(event){ window.href="http://jquery.com/";; <http://jquery.com/> alert("Thanks for visiting!"); return true; }); }); http://jquery.com/>">jQuery cheers. Ragx
[jQuery] Re: JQuery Introduction
Sikandar123456 wrote: > A very good lecture on jquery > > http://saqibshehzad.blogspot.com/2008/09/jquery.html > John Resig has a Mini Me! :D http://www.austinpowers.com/objects/desktops/minime_1280x960.jpg Sorry, couldn't resist. I'll get my coat...