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

Popular posts from this blog

python - Scipy curvefit RuntimeError:Optimal parameters not found: Number of calls to function has reached maxfev = 1000 -

c# - How to add a new treeview at the selected node? -

java - netbeans "Please wait - classpath scanning in progress..." -