jQuery UI - 我什么时候应该在小部件上使用 destroy 方法
当我将功能附加到某个元素时,我是否需要在从 DOM 中删除它之前调用 .widgetName('destroy')
,还是 jQuery 会处理这个问题?
When I attach functionality to an element do I need to call .widgetName('destroy')
before removing it from the DOM or does jQuery handle this?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
尝试使用
remove
。我不认为这种情况会自动发生,但话又说回来,我认为您不需要调用
destroy
方法,因为事件处理程序
会从删除中为您销毁称呼。Try using
remove
.I don't think this happens automatically, but then again, I don't think you need to call the
destroy
method as theevent handlers
are destroyed for you from the remove call.