Loading ...

On clicking hyperlink the page focus reaches at the top

Who is online?  0 guests and 0 members
home  »  forums   »  asp.net topics   »  client side web development   » On clicking hyperlink the page focus reaches at the top

On clicking hyperlink the page focus reaches at the top

Posts under the topic: On clicking hyperlink the page focus reaches at the top

Posted: 3/7/2010

Lurker 105  points  Lurker
  • Joined on: 11/1/2009
  • Posts: 21

Hi,

I have an hyperlink <a href="#">Play</a> Now I have binded the click event of this anchor link with jQuery . The issue is that when I click the link the page focus reaches at the top , this is annoying how can i overcome this issue.


Posted: 3/9/2010

Guru 16813  points  Guru
  • Joined on: 4/19/2009
  • Posts: 490
  Answered

Write e.preventDefault(); in clickevent handler

$('#anchorid').click(function(e)

{

//your stuff

e.preventDefault();

});


Page 1 of 1 (2 items)