A href JavaScript void is an operator that is used to return an undefined value so the browser will not be able to load a new page. Web Developers use javascript:void(0) because it is the easiest way to prevent the default behavior of anchor tag.
<a href="javascript:void(0);">link</a>
How to ignore link <a> href JavaScript void 0
HTML example code href=”javascript:void(0); is for the case that you want it to do nothing, but still look like a link. ( blue and underline). It prevents the page to reload.
<!DOCTYPE HTML>
<html>
<body>
<a href="javascript:void(0);">link</a>
</body>
</html>
Output:
Do comment if you have any doubts and suggestions on this JS href topic.
Note: The All JS Examples codes are tested on the Firefox browser and the Chrome browser.
OS: Windows 10
Code: HTML 5 Version