I have the below which disables all hyperlinks but after an event I want to enable them back all again, how can I do this?
$("a").click(function() { return false; });
I don't think its as simple as just setting it to true. ;)
Thanks all
I have the below which disables all hyperlinks but after an event I want to enable them back all again, how can I do this?
$("a").click(function() { return false; });
I don't think its as simple as just setting it to true. ;)
Thanks all
Binding and unbinding takes some overhead.
A different solution would be to add a class like
disabled
, then usehasClass('disabled')
to test and see whether or not it should returnfalse
.Try this:
bye
you could unbind the click handler:
Another way, if you strictly want the url to be inaccessible as well, you can remove
href
attribute froma
tag. Something like that:additionaly changing color of text and onhover cursor: