Reputation: 46479
I have a logic like this:
$('.myElement').on('DOMSubtreeModified', function() {
if(something == true) {
$('.myElement').off('DOMSubtreeModified');
// Execute some code
}
});
Will the // Execute some code
be executed after I remove DOMSubtreeModified
listener? I do this to ensure that same code is not executed if certain condition is met, hence need to stop listening to DOM
changes.
Upvotes: 2
Views: 717
Reputation: 4886
Try this:
$('.myElement').off('DOMSubtreeModified', arguments.callee);
Upvotes: 5