Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Href attribute for JavaScript links: "#" or "javascript:void(0)"?
Href attribute for JavaScript links: "#" or "javascript:void(0)"? [message #1057728] Wed, 08 May 2013 09:26 Go to next message
Hi-Tech ITO is currently offline Hi-Tech ITO
Messages: 2
Registered: May 2013
Location: Ahmedabad
Junior Member
When building a link that has the sole purpose to run JavaScript code, there are 2 ways to write the code. Which is better, in terms of functionality, page load speed, validation purposes, etc?

<a href="#" onclick="myJsFunc();">Run JavaScript Code</a>

or

<a href="javascript:void(0)" onclick="myJsFunc();">Run JavaScript Code</a>

Re: Href attribute for JavaScript links: "#" or "javascript:void(0)"? [message #1057762 is a reply to message #1057728] Wed, 08 May 2013 11:33 Go to previous message
David Wegener is currently offline David Wegener
Messages: 1157
Registered: July 2009
Senior Member
Web questions need to be asked on the Web Tools forums. This is the Eclipse Java Development Tools forum.
Previous Topic:Eclipse won't start
Next Topic:overlaps the workspace location
Goto Forum:
  


Current Time: Tue May 28 06:22:55 EDT 2013

Powered by FUDForum. Page generated in 0.02255 seconds