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
I wrote a snippet that will check for the change of an element on an event.
So if you are using third party javascript code or something and you need to know when something appears or changes when you have clicked then you can.
For the below snippet, lets say you need to know when a table content changes after you clicked a button.
$('.button').live('click', function() {
var tableHtml = $('#table > tbody').html();
var timeout = window.setInterval(function(){
if (tableHtml != $('#table > tbody').
console.log('no change');
} else {
console.log('table changed!');
clearInterval(timeout);
}
}, 10);
});
Pseudo Code: