views:

142

answers:

1

In my case i'm writing a Chrome Extension, I don't have access to the other JS that is happening on the page. So I need to make sure that whenever certain elements update their content I rerun a function from the extension.

Basically a Change event that can be triggered from innerHTML changing.

+2  A: 

Since it's for a Chrome extension, might as well the standard DOM Mutation events.

Listen to DOMSubtreeModified on the document. Just tested on Chrome 5.0.375.99 and it is supported.

document.addEventListener('DOMSubtreeModified', myFunction);
Anurag
This works great in my Safari and Chrome Extension. Thank you. However it does not work in a greasemonkey version of the same script, any ideas?
drye