1
是否可以通過jQuery直播活動來從DOM中刪除元素刪除?jQuery - 刪除生活中的聽力元素
我需要這樣的東西:
$('body').on('remove', '.selector', function() {
console.log('Element removed.');
});
但它不工作:(
是否可以通過jQuery直播活動來從DOM中刪除元素刪除?jQuery - 刪除生活中的聽力元素
我需要這樣的東西:
$('body').on('remove', '.selector', function() {
console.log('Element removed.');
});
但它不工作:(
你正在尋找可能的內容:
$.fn.customRemove = function() {
$(this).remove();
console.log('Element removed.');
};
$('.selector').customRemove(); // you will get the log automatically
可惜的是,這不是解決我的問題,我想要創建一個通用的監聽器來處理所有被刪除的元素(以標準方式),而不是手動破解原始代碼。 –