Listen to changes within a DIV and act accordingly

后端 未结 7 594
谎友^
谎友^ 2020-11-28 23:34

I have a function that grabs an XML document and transforms it according to an XSL document. It then places the result into a div with the id laneconfigdisplay

7条回答
  •  遥遥无期
    2020-11-29 00:15

    Though the event DOMSubtreeModified is deprecated, its working as of now, so for any makeshift projects you can use it as following.

    $("body").on('DOMSubtreeModified', "#mydiv", function() {
        alert('changed');
    });
    

    In the long term though, you'll have to use the MutationObserver API.

提交回复
热议问题