To create an HTML link that does nothing when clicked, you can use the href
attribute with a value of javascript:void(0);
.
This will effectively create a link that, when clicked, executes a JavaScript function that does nothing.
For example we write:
<a href="javascript:void(0);">Click here</a>
This link will appear as clickable text (“Click here”), but clicking on it will not cause any navigation or action to occur.