views:

18

answers:

2

Hi, I am using

$("#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

A: 

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.

Spudley
+2  A: 

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;
});
betamax
Thank you. It is working.
Raj