Using jQuery's animate(), if the clicked on element is "<a href="#" ...> </a>", the fucntion should

Posted by Jian Lin on Stack Overflow See other posts from Stack Overflow or by Jian Lin
Published on 2010-06-15T01:34:06Z Indexed on 2010/06/15 1:42 UTC
Read the original article Hit count: 274

I was reading jQuery's page for animate()

http://api.jquery.com/animate/

Its examples don't mention about if using

<a href="#" id="clickme">click me</a>
...

$('#clickme').click(function() {
    $('#someDiv').animate({left: "+=60"});
})

we actually still have to return false like in the old days?

$('#clickme').click(function() {
    $('#someDiv').animate({left: "+=60"});
    return false;
})

(but then, those examples didn't use a <a> for the "click me"... but used something else.

Otherwise the page will jump back to the beginning of the page? Does jQuery have a more elegant or magical way of doing it?

© Stack Overflow or respective owner

Related posts about jQuery

Related posts about javascript-events