zeacuss zeacuss - 1 year ago 62
jQuery Question

Listening to events such as adding new elements in JavaScript

I need to create an event listener such that, when a new element is added to the document, or any of its child, my event handler gets called.

Any ideas how to do this using?

Answer Source
.bind('DOMNodeInserted DOMNodeRemoved')

this are the events to check element is inserted or removed.

bind on parent element this event.

and call your function in handler

js fiddle demo : http://jsfiddle.net/PgAJT/

click here for example... http://help.dottoro.com/ljmcxjla.php