Is it possible for me to observe when the HTML has changed inside a <tr> tag?
I can't use jQuery, prototype or any other framework.
As soon as the content changes I need to act on it and stuck how to handle this.
Is it possible for me to observe when the HTML has changed inside a <tr> tag?
I can't use jQuery, prototype or any other framework.
As soon as the content changes I need to act on it and stuck how to handle this.
You can monitor the DOM with a timer:
var currentDOM = getCurrentStatus(); // made that up
var timer = setInterval(function() {
var newDOM = getCurrentStatus();
if (currentDOM !== newDOM) {
// do whatever
currentDOM = newDOM;
}
}, 100);
That'll check the contents every 100ms. If you have to do a lot of work to figure out whether the DOM has been changed, that might be too fast in that it might make the client machine sluggish.
You can cancel that activity later if you need to:
clearInterval( timer );
Change detection in terms of plain javascript should be a matter of storing an initial val and checking against that on a time interval. if anyone else knows of a better way, I'd like to hear it. Of course, jquery is powerful for those type of applications, but since you can't use that, I'll stick with my above answer.