如何使用JQuery删除动态内容?
我有一个由 CMS 生成的 html 页面。我无法修改页面,但可以添加 JavaScript。
每次加载页面时,JavaScript 函数(我无法修改)都会动态地将一个段落插入到页面上。
每当加载该段落时,如何使用 JQuery .remove() 该段落?
例如,当页面首次加载时,它看起来像这样(空白):
<div></div>
然后,几秒钟后,一个 JavaScript 函数(我无法控制)向页面添加一个段落。然后页面看起来像这样:
<div><p id="foo">bar</p></div>
每次动态加载到页面时,如何使用 JQuery 删除 id=foo 的段落?
I have an html page that is generated by a CMS. I cannot modify the page, but can add JavaScript.
Each time the page loads, a JavaScript function (that I cannot modify) dynamically inserts a paragraph onto the page.
How can I use JQuery to .remove() that paragraph whenever it is loaded?
For example, when the page first loads, it look like this (blank):
<div></div>
Then, a few seconds later, a JavaScript function (that I have no control over) adds a paragraph to the page. The page then looks like this:
<div><p id="foo">bar</p></div>
How can I use JQuery to remove the paragraph with id=foo each time it is dynamically loaded onto the page?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可以使用 liveQuery 插件 来实现此目的:
You can use the liveQuery plugin for this: