javascript finished dom changes code example
Example 1: jquery on dom change
$("#someDiv").bind("DOMSubtreeModified", function() {
alert("tree changed");
});
Example 2: javascript detect when number of elements change
const targetNode = document.body;
const config = { childList: true, subtree: true };
const callback = function(mutationsList, observer) {
for(let mutation of mutationsList) {
if (mutation.type === 'childList') {
}
}
};
const observer = new MutationObserver(callback);
observer.observe(targetNode, config);