How To Make Link Unclickable Using CSS Or Jquery?
I have the following HTML.
-
Solution 1:
Different options:
$('a[href="test.php"]').click(function(){ return false; });
or
$("static dynamic-children a.menu-item").click(function(){ return false; });
You can also use event.preventDefault() which prevents the default/expected behaviour of a link. Use like:
$("static dynamic-children a.menu-item").click(function(event){ event.preventDefault(); });
Solution 2:
Write
return false
$("a.menu-item").click(function(){ return false; });
OR
e.preventDefault()
$("a.menu-item").click(function(e){ e.preventDefault(); });
Solution 3:
You can cancel the link behavior by firing
preventDefault()
on the click of this link:$("a.menu-item").click(function(evt){ evt.preventDefault(); });
Post a Comment for "How To Make Link Unclickable Using CSS Or Jquery?"