What should be the href property value of anchor tag in case we want to handle the click event

 Posted by Poster on 2/4/2010 | Category: HTML 5 Interview questions | Views: 3959

The href property of anchor tag should be "javascript:void(0)" when we want to handle the click event of the anchor tag. Many people keep href="#" that jump the screen to top when the link is clicked.

<a id="closeLink"  href="javascript:void(0)" onclick="Clicked()" title="Whatever">Whatever link</a>

In other way we can also write like this
<a id="closeLink"  href="javascript:Clicked()" title="Whatever">Whatever link</a>

Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response