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

Topic RSS Feed

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

Posted: 3/7/2010 1:19:45 PM

Lurker 105 points Lurker
  • Joined on: 11/1/2009 2:23:31 AM
  • 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 8:31:43 PM

Professional 9529 points Professional
  • Joined on: 4/19/2009 1:46:52 AM
  • Posts: 219
answered  Answered

Write e.preventDefault(); in clickevent handler

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

{

//your stuff

e.preventDefault();

});


Page 1 of 1 (2 items)