Answers for "how to enable and disable href in javascript"

0

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;
Posted by: Guest on March-17-2021

Code answers related to "how to enable and disable href in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language