JSFiddle - React, Tailwind, and code Playground
HTML
<a href="www.google.com.au">LINK</a>
CSS
style>
a:link {color:#000000; background-color:transparent; text-decoration:none}
a:visited {color:#000000; background-color:transparent; text-decoration:none}
a:hover {color:#ff0000; background-color:transparent; text-decoration:underline}
a:active {color:#ff0000; background-color:transparent; text-decoration:underline}
</style>
JavaScript
// Function that does nothing, but prevents default event handler
function disableLink(e) {
e.preventDefault();
};
window.onload = function() {
// Bind above event handler to all anchors
var els = document.getElementsByTagName('a');
[].forEach.call(els, function(el, i) {
el.addEventListener("click", disableLink);
alert('1');
});
// Remove it in 5 seconds
setTimeout(function() {
var els = document.getElementsByTagName('a');
[].forEach.call(els, function(el, i) {
el.removeEventListener("click", disableLink);
alert('11');
});
}, 5000);
};