Detect element content changes with jQuery

后端 未结 15 2254
余生分开走
余生分开走 2020-11-22 04:19

change() function works and detects changes on form elements, but is there a way of detecting when a DOM element\'s content was changed?

This does not w

15条回答
  •  渐次进展
    2020-11-22 05:07

    what about http://jsbin.com/esepal/2

    $(document).bind("DOMSubtreeModified",function(){
      console.log($('body').width() + ' x '+$('body').height());
    })
    

    This event has been deprecated in favor of the Mutation Observer API

提交回复
热议问题