If you don't want use timer and check innerHTML you can try this event
$('mydiv').bind('DOMSubtreeModified', function(){
console.log('changed');
});
More details and browser support datas are Here.
Attention: in newer jQuery versions bind() is deprecated, so you should use on() instead:
$('body').on('DOMSubtreeModified', 'mydiv', function(){
console.log('changed');
});
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…