Reputation: 941
Is is possible to listen element removals from DOM with a jQuery live event?
I need something like:
$('body').on('remove', '.selector', function() {
console.log('Element removed.');
});
But it is not working :(
Upvotes: 1
Views: 42
Reputation: 1
Maybe what you're looking for:
$.fn.customRemove = function () {
$(this).remove();
console.log('Element removed.');
};
$('.selector').customRemove(); // you will get the log automatically
Upvotes: 4