How to execute a JS method on any DOM change in the HTML page at runtime

You need to bind a function to the DOMSubtreeModified mutation event:

$(document).bind('DOMSubtreeModified', function () {
    <Code to Execute>

If your target browsers support it, you should use a MutationObserver instead.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.