Detect paragraph element change with JQuery

后端 未结 7 1955
爱一瞬间的悲伤
爱一瞬间的悲伤 2020-12-06 17:58

Is it possible to detect if the content of a paragraph has been changed in JQuery ?

I tried the below code.

Text

7条回答
  •  清歌不尽
    2020-12-06 18:27

    You can use 'DOMSubtreeModified' to check the dom changes on html tag elements. See the support for this event across browsers.

    http://jsfiddle.net/nnbqye55/7/

    $(document).on("DOMSubtreeModified", "#test", function () {
        alert("Paragraph changed");
    });
    

提交回复
热议问题