Returning false is fine, but there's also event.preventDefault():
http://docs.jquery.com/Events_%28Guide%29#event.preventDefault.28__.29

$('a').click(function(e) { e.preventDefault(); });

--Erik


On 4/6/08, Michael Sharman <[EMAIL PROTECTED]> wrote:
>
>
> Hi guys,
>
> I am "listening" for an href click in my document.ready function and I
> want to make sure the href isn't followed by the browser for users who
> have javascript turned on, and is followed by users who have
> javascript turned off. This is my href:
>
> <a href="http://mysite.com/gohere.html"; id="hrefCreate">Click me</a>
>
> The way I'm doing the javascript is (note the "return false"):
>
> $(document).ready(function(){
>
>         $('a#hrefCreate').click(function(){
>                 //do something here
>                 return false;
>         });
>
> });
>
> This is working fine (i.e. the "return false) but I just want to check
> if this is the best practice way to do this and if it's cross browser
> etc.
>
> The reason I ask is that in Prototype.js there is an Event.stop which
> halts all processing and allows you to do what you want in your
> function.
>
> Is there similar in jQuery or will return false suffice?
>
> Thanks guys.
>

Reply via email to