Answers for "disable link 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
2

html disable anchor link

a.isDisabled {
  pointer-events: none;
}
Posted by: Guest on April-16-2020
0

html how to give false link

document.getElementById("nothing").addEventListener("click", function(event){
event.preventDefault()
});
Posted by: Guest on July-23-2020
0

html how to give false link

<a id="nothing" href="#">Link</a>
Posted by: Guest on July-23-2020

Browse Popular Code Answers by Language