[jQuery] Re: processing all links on page with jquery

2009-02-12 Thread James
Add a "return false;" at the end. $(document).ready(function() { $("a.rate").click(function () { // do your stuff return false; }); }); On Feb 12, 12:56 pm, introvert wrote: > This works great. > One more thing: when I click a link with onclick event it will first > preform javascrip

[jQuery] Re: processing all links on page with jquery

2009-02-12 Thread introvert
This works great. One more thing: when I click a link with onclick event it will first preform javascript action and then go to the url. How do I prevent the second step - disable the link so that it wouldn't go to that url after the click? (in current situation using ajax has no benefit). Thanks

[jQuery] Re: processing all links on page with jquery

2009-02-12 Thread James
$(this) will refer to the one that was clicked on. $(document).ready(function() { $("a.rate").click(function () { alert($(this).attr('href')); }); }); On Feb 12, 12:20 pm, introvert wrote: > But in this case how can I read url (a href) from the a tag for each? > > On Feb 12, 11:17 pm, Ja

[jQuery] Re: processing all links on page with jquery

2009-02-12 Thread introvert
But in this case how can I read url (a href) from the a tag for each? On Feb 12, 11:17 pm, James wrote: > Personally, it's easier to use just a class. It will account for all > with class "rate". > > > $(document).ready(function() { >  $("a.rate").click(function () { //ajax call });}); > > >

[jQuery] Re: processing all links on page with jquery

2009-02-12 Thread James
Personally, it's easier to use just a class. It will account for all with class "rate". $(document).ready(function() { $("a.rate").click(function () { //ajax call }); }); rate up rate up On Feb 12, 12:08 pm, introvert wrote: > Hello. > > I'm working on a simple thumbs up/down functionality