Definition
- A JavaScipt API to watch a given element for any changes to the DOM that happens inside it.
- More Details on Mutation Observers
Usage
- This lets you make changes to code injected from Banno tags after the page loads.
Basic Setup
// select a single element (querySelectorAll will need a forEach() set up to work)
const targetElement = document.querySelector('#id or .class selector');
// if element exists, observe
if (targetElement != null){
const targetElementObserver = new MutationObserver(function(){
// do stuff to things
});
observer.observe(targetElement, {subtree: true, childList: true});
}