I have this html code
<div>
<p>MY Text <a href="url">Text</a>
</p>
</div>
I need to use CSS or jQuery disable all A (link) elements in a DIV, when the user moves the mouse over the word: "Text", I want the URL to be inactive so they can't click on it. How do I do that?
To prevent an anchor from following the specified HREF, I would suggest using preventDefault():
$(document).ready(function() {
$('div a').click(function(e) {
e.preventDefault();
});
})
See: Event Object
or
$("div a").click(function(){
alert('disabled');
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