jQuery UI - 我什么时候应该在小部件上使用 destroy 方法

发布于 2024-07-08 05:37:17 字数 114 浏览 16 评论 0原文

当我将功能附加到某个元素时,我是否需要在从 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

听,心雨的声音 2024-07-15 05:37:18

尝试使用 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 the event handlers are destroyed for you from the remove call.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文