Is there any way to ‘disable’ or ‘suspend’ a jquery .click function, without unbinding? I want to leave the function bound, but don’t want it to fire. Then, at a later time, I would like to re-enable it.
Just disabling the control being bound to will not suffice in this case.
You could set a flag in a higher variable scope and only execute the handler if the flag is on. Here’s a simple example:
It’s a similiar solution to: Suppress jQuery event handling temporarily