I think the best way is to execute the function directly after the insertion/removal of an element.
Otherwise, you can use a setInterval() and do a check on the element count with: $("*").length; to see if it changed. On Jun 30, 2:34 pm, Khai <khaitd...@gmail.com> wrote: > Hello, > > I want to be able to run a function every time an element is removed > on inserted into the document. How can I do this? > > Thanks! > > Khai