Ok, let’s say that I have a button and I would like to enable/disable its click handlers.
I would like to create functions like these:
var bar = [];
function storeHandlers(buttonID) {
//I would like to store the click handlers in bar[buttonID]
}
function preventHandlers(buttonID) {
storeHandlers(buttonID);
//I would like to disable all the click handlers for button
}
function loadHandlers(buttonID) {
//I would like to enable all the handlers loaded from bar[buttonID]
}
Is this possible? How can I achieve this?
Thank you in advance
Just try this:
That’s it!
jsFiddle example: http://jsfiddle.net/cec6z/9/