I want to disable a link while certain conditions exist on the page, but re-enable it once those conditions go away. So I have a function that executes regularly that checks for the condition.
if(!enabled) {
$(button).click(function(){return false;});
}
How do I “re-enable” that click event so that it performs the normal action? All I want it to do is behave like a normal link.
You can put a custom event namespace on your link, and bind/unbind it when necessary:
Disabling:
Enabling:
Please check out the jsFiddle Demo.