DIV onchange event

IS there a way to trigger an onchange event from a DIV,
eg, I have a DIV like this

<div id="resultb"></div>

so, when i change the content on this DIV using

document.getElementById('resultb').innerHTML = "xxxxx"

I would like to fire an event, is this possible?


Not that I know of.

You could just call the function when you update the html. You could glorify it by setting the html through a custom method/psuedo event like

document.getElementById('resultb').onHTMLUpdate = function() {
document.getElementById('resultb').setInnerHTML = function(html) {
    this.innerHTML = html;

But that won’t work if innerHTML is directly accessed.

You could also poll the status using setInterval(myFuncWhichChecksIfChangedThenCallsAnotherFunction, 100)