Does anybody know how to unbind set of event handlers, but memorize them in order to bind them again later? Any suggestions?
question from:https://stackoverflow.com/questions/516265/jquery-unbind-event-handlers-to-bind-them-again-laterDoes anybody know how to unbind set of event handlers, but memorize them in order to bind them again later? Any suggestions?
question from:https://stackoverflow.com/questions/516265/jquery-unbind-event-handlers-to-bind-them-again-laterThere is a events element in the data of the item. This should get your started, you can read your elements and store the handlers in an array before unbinding. Comment if you need more help. I got this idea from reading the $.fn.clone method so take a look at that as well.
$(document).ready(function() {
$('#test').click(function(e) {
alert('test');
var events = $('#test').data("events");
$('#test').unbind('click', events.click[0]);
});
});
<a id="test">test</a>