Should I leave href empty when implementing click events via jQuery?

Posted by dreza on Programmers See other posts from Programmers or by dreza
Published on 2012-11-29T00:49:50Z Indexed on 2012/11/30 23:20 UTC
Read the original article Hit count: 204

Filed under:

Is it preferable to have # in a link's href attribute when I am implementing the click event via jQuery, or is it ok to leave href empty?

i.e.

<a id="myLink" href="#" />

vs

<a id="myLink" href="" />

When I'm doing

$("#myLink").on('click', function() {
   // do ajaxy stuff
});

Although I understand the click event could be on a span or other such element I'm interested in this case for particular best practices when using an a tag.

© Programmers or respective owner

Related posts about html