How can I detect when a new element has been added to the document in jquery?

0

Issue

How can I detect when a new element has been added to the document in jquery ?

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.

How can I do this ? I use jQuery javascript library.

Solution

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:
It seems that the link was broken. Try this link

Answered By – Marnix

This Answer collected from stackoverflow, is licensed under cc by-sa 2.5 , cc by-sa 3.0 and cc by-sa 4.0

Leave A Reply

Your email address will not be published.

This website uses cookies to improve your experience. We'll assume you're ok with this, but you can opt-out if you wish. Accept Read More