[jQuery] Re: Any benefit to using event.preventDefault() over return false to cancel out an href click?

2009-04-20 Thread John Resig
return false does e.preventDefault() and e.stopPropagation(). --John On Mon, Apr 20, 2009 at 3:20 PM, kgosser kgos...@gmail.com wrote: Just curious if there is a best practice when choosing between $(a).click(function(){   // stuff   return false; }); and $(a).click(function(){  

[jQuery] Re: Any benefit to using event.preventDefault() over return false to cancel out an href click?

2009-04-20 Thread kgosser
Thanks, John. So is it advisable to use one form or another? I've used return false throughout my app, and I'm trying to decide if it's a best practice to change it to preventDefault() if it's wiser to do so. On Apr 20, 2:26 pm, John Resig jere...@gmail.com wrote: return false does

[jQuery] Re: Any benefit to using event.preventDefault() over return false to cancel out an href click?

2009-04-20 Thread Josh Powell
It sounds like John is saying that e.preventDefault() will prevent the default event from occuring and e.stopPropogation() will prevent the event from bubbling up and return false will do both, so If you only want to stop the default but allow propogation or vice versa, then use the methods,