Ads by ProfitSence

What does Javascript:void(0) means?

Last Updated on Wednesday 5th Oct 2022


  • Sometimes in the process of writing js, we need to trigger an event without returning a value.
  • Then we may need to write this way href="#"Contains a piece of location information.
  • The default anchor is #top, which is the top of the web page. When this link is clicked continuously, it will cause the browser to slow down or even crash.

javascript:;Better, javascript::void(0)it is said that there are browser compatibility bugs in some cases.

					<a href="javascript::void(0)" onClick=""> </a>


After clicking the link, the page does not move, only the link is opened

					<a href="#" onclick="javascript:return false;">  Action above, there will be differences in different browsers.


void(0); void(0)

"#" contains a location information. The default anchor point is #top, which is the top of the page and javascript::void(0) only represents a dead link.

  • The browsing link is obviously #, but it jumps to the top of the page and javascript::void(0) not so. When calling the script, it is best to use void(0)
					<a href="####"></a>

<a href="javascript::void(0)"></a>

<a href="javascript:void(null)"></a>

<a href="#" onclick="return false"></a>

  • <a href="javascript::void(0)">.Nothing will happen when you click here. In other words, if you want to perform some processing but do not refresh the page as a whole, you can use void(0), but when you need to refresh the page, you must be careful Up.