InnerHTML 的 JQuery 更改事件

发布于 2024-09-10 20:24:19 字数 125 浏览 1 评论 0原文

就我而言,我正在编写一个 Chrome 扩展,我无法访问页面上发生的其他 JS。因此,我需要确保每当某些元素更新其内容时,我都会从扩展中重新运行函数。

基本上是一个可以由innerHTML 更改触发的Change 事件。

In my case i'm writing a Chrome Extension, I don't have access to the other JS that is happening on the page. So I need to make sure that whenever certain elements update their content I rerun a function from the extension.

Basically a Change event that can be triggered from innerHTML changing.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

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

发布评论

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

评论(1

短暂陪伴 2024-09-17 20:24:19

由于它是针对 Chrome 扩展的,因此也可以采用标准 DOM 突变事件

监听 document 上的 DOMSubtreeModified。刚刚在 Chrome 5.0.375.99 上测试,支持。

document.addEventListener('DOMSubtreeModified', myFunction);

Since it's for a Chrome extension, might as well the standard DOM Mutation events.

Listen to DOMSubtreeModified on the document. Just tested on Chrome 5.0.375.99 and it is supported.

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