Can Javascript Listen For "ondomchange" On Every Dom Elements?
My question is somewhat weird, but can i add events for any DOM elements(div), like 'onHtmlChange', to be notified when that div has changed their content?
Solution 1:
Check out DOMNodeInserted and DOMNodeRemoved.
Ben Nadel recently blogged the following: Detecting When DOM Elements Have Been Removed With jQuery
Solution 2:
The DOMNodeInserted and DOMNodeRemoved are part of the Mutation Events which is now deprecated. Hence, you need to take a look on Mutation Observer. I did the same in one of my project which is I needed to listen to the DOM changes of a certain element., e.g. DOM append, remove, attribute, and data changes.
These links will help you :
Post a Comment for "Can Javascript Listen For "ondomchange" On Every Dom Elements?"