javascript - jQuery: How can I detect if the html has changed within a given element? -
in javascript, possibly using jquery, how can detect if html content of given element has changed?
i'd able somthing like:
$('#mydiv').change(function(){ // stuff });
i trying detect if given elements being added div or if inner html of given elements (such labels) has changed , hide or show div depending on content.
any alternative idea how achieve smt appreciated.
i hoping won't have revert obscure plugin this!
note: needs work @ least in ie8!
you can use dom level 3 event domnodeinserted. example:
$('#mydiv').bind('domnodeinserted', function(e) { console.log('element: ', e.target, ' inserted); });
demo: http://www.jsfiddle.net/vsgdz/1/
the event fire whenever new node appended element on bind handler.
Comments
Post a Comment