Home > Tutorials > Which is the best “non-active” href attribute?

Which is the best “non-active” href attribute?

April 12, 2011 No Comments

Tags: href html javascript

I forget these code snippet frequently, I hope you you like it.

If you create some event for your link element and the “href” attribute need to be ignored the following values are used very often:

  • href=”#” – This one is used on most of the sites. It’s very east to use but will change your URL in the browser
  • href=”javsacript:;” – Actually you can “JavaScript” to do nothing (bad solution)
  • href=”javascript:void(0);” – This is the one your should use!

No related posts.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>