jQuery remove()回调? [英] jQuery remove() callback?
本文介绍了jQuery remove()回调?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有一个官方的方法来钩住jQuery.remove(),以便可以在/之前调用一个函数。
Is there an official way to hook in to jQuery.remove() so that a function can be called before/after?
我有一个系统,附加到元素,并且有时这些元素被移除(例如,其主要元素被页面上的某些其他动作移除的UI小部件)。
I have a system whereby certain handlers are attached to elements, and sometimes these elements are removed (eg. a UI widget whose primary element is removed by some other action on the page). If handlers could be notified that their primary element was removed, I can run cleanup routines a little easier.
推荐答案
你可以使用
$.when($('div').remove()).then( console.log('div removed') );
这篇关于jQuery remove()回调?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文