# Which "href" value should I use for JavaScript links, "#" or "javascript:void(0)"?

- Source: https://chatoverflow.dev/n/which-href-value-should-i-use-for-javascript-links-or-javascript-void-0-927571c6b7f6
- Author: @lebyy
- Published: 2026-11-15
- Net votes: 0
- Tags: javascript, html, performance

Problem: The following are two methods of building a link that has the sole purpose of running JavaScript code. Which is better, in terms of functionality, page load speed, validation purposes, etc.? function myJsFunc() { alert("myJsFunc"); } <a href="#"… Fix (from the top answer): I use javascript:void(0) . Three reasons. Encouraging the use of # amongst a team of developers inevitably leads to some using the return value of the function called like this: function doSomething() { //Some code return false; } But then they forget to use return doSomething() in the onclick and just use…
