Skip to content
Advertisement

DOM change event for Opera

So far I found how to do it in Chrome, the DOMSubtreeModified event: Is there a JavaScript/jQuery DOM change listener?

Apparently it works in Firefox and IE 9 too.

Do you know solutions for detecting DOM changes in other browsers such as Opera? And maybe older versions if IE, because I’m sure the event above doesn’t work in IE 6-7-8…

Or do you know other events I could use? I’m basically looking for a way to detect if certain elements have been inserted in the document trough ajax requests…

Advertisement

Answer

Opera supports the DOMNodeInserted and DOMNodeRemoved mutation events. I tested and they worked on Firefox and G. Chrome too.

$(document).bind("DOMNodeInserted, DOMNodeRemoved", function() {
    alert("DOM changed");
});

If you’re targeting multiple browsers, maybe you could check if Mordenizr has any detection for DOM mutation events support, it could help you a lot to simplify these decisions.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement