views:

295

answers:

1

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?

+2  A: 

Check out DOMNodeInserted and DOMNodeRemoved.

Ben Nadel recently blogged the following: Detecting When DOM Elements Have Been Removed With jQuery

Jonathan Sampson
Seems like the OP wants to know when HTML content inside of the divs has changed though.
seth
@seth —Browsers which use the W3C model should fire both `DOMNodeInserted` and `DOMNodeRemoved` when changing a node's contents, even it it's just text nodes (just tested FF3). The IE trick mentioned in the linked article could easily be extended to `.html()` and `.text()` to mimic this.
Ben Blank