Reputation: 307
$("#list").slideDown("slow"); //code to slide down the div dag when it is clicked.
It is working fine but when I clicked on the tag, the browser is suddenly scrolling up to the top.
So I have to scroll down to the tag to see its contents.
Please help me.
Thanks,
Raj
Upvotes: 0
Views: 290
Reputation: 14041
In your click handler, you need to return false
or use event.preventDefault();
. An example click handler would be:
$("#element").click(function(event){
$("#list").slideDown("slow");
return false;
});
Upvotes: 4
Reputation: 168685
Without seeing more of your HTML code it's impossible to be certain, but this behaviour is usually seen when you have something like <a href='#' onclick='.....'>
. The #
tells the browser to go to the top of the page.
Upvotes: 0