Possible Duplicate:
Override default behaviour for link ('a') objects in Javascript
What is the best way for making entire page links in home page read only (non clickable like href=#
or href="javascript:void()"
based on a user action.
I wanted to use only Javascript and CSS to achieve this.
Only css
a {
pointer-events: none;
cursor: default;
}
try
with jquery
$("a").click(function() { return false; });
vanilla js
var elements = document.getElementsByTagName("a");
for (var i = 0; i < elements.length; i++) {
elements[i].onclick = function () { return false; }
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With