disable hyperlink in javascript code example
Example: how to enable and disable href in javascript
// Example link
// <a id="my-link" href="https://codegrepper.com">Text</a>
var a = document.getElementById("my-link");
a.originalLink = a.href;
// disable link
a.href = 'javascript:void(0)';
// re-enable link
a.href = a.originalLink;