How To Make Link Unclickable Using Css Or Jquery?
I have the following HTML.
Solution 1:
Different options:
$('a[href="test.php"]').click(function(){ returnfalse; });
or
$("static dynamic-children a.menu-item").click(function(){ returnfalse; });
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(){ returnfalse; });
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?"