如何在jquery中检测新元素何时添加到文档中? [英] How can I detect when a new element has been added to the document in jquery?
本文介绍了如何在jquery中检测新元素何时添加到文档中?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在jquery中检测到新元素何时被添加到文档中?
How can I detect when a new element has been added to the document in jquery ?
说明:
我想知道当一个元素column-header已添加到文档中。因为我打算在这些元素上运行一些javascript。
Explanation: I want to know when an element with class "column-header" has been added to the document. As I plan to run some javascript on those elements.
我该怎么做?我使用jQuery的javascript库。
How can I do this ? I use jQuery javascript library.
推荐答案
如果你想做一些jQuery上,你也可以做一些像 livequery(额外插件):
If you want to do some jQuery on it, you can also do something like livequery (extra plugin):
$('column-header').livequery(function()
{
// do things here with your column-header, like binding new events and stuff.
// this function is called when an object is added.
// check the API for the deletion function and so on.
});
UPDATE :
看来链接已损坏。请尝试此链接
这篇关于如何在jquery中检测新元素何时添加到文档中?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文