JSFiddle - React, Tailwind, and code Playground

by alnitak

HTML

<div id="foo" class="test">
</div>
<div id="bar" class="test">
</div>

JavaScript

(function($) {
    var _remove = $.fn.remove;
    $.fn.remove = function() {
        this.trigger('remove'); // notify removal
        return _remove.apply(this, arguments); // call original
    };
})(jQuery);


$('.test').bind('remove', function() {
    alert(this.id + ' is being removed');
});

$('.test').remove();