Adding listener to div tag to view innerHtml content
3 answers
You can use setInterval
to periodically check the content and act accordingly, for example:
function innerHTMLChanged() {
if$("#myDiv").html() != "Some HTML for comparison, perhaps the previous state?") {
$("#myDiv").hide();
} else {
$("#myDiv").show();
}
}
// fires every half a second
setInterval(innerHTMLChanged, 500);
+1
a source to share