Skip to content

Instantly share code, notes, and snippets.

@jookyboi
Created July 10, 2013 00:34
Show Gist options
  • Save jookyboi/5962573 to your computer and use it in GitHub Desktop.
Save jookyboi/5962573 to your computer and use it in GitHub Desktop.
// select the target node
var target = document.querySelector('#some-id');
// create an observer instance
var observer = new MutationObserver(function(mutations) {
mutations.forEach(function(mutation) {
console.log(mutation.type);
});
});
// configuration of the observer:
var config = { attributes: true, childList: true, characterData: true };
// pass in the target node, as well as the observer options
observer.observe(target, config);
// later, you can stop observing
observer.disconnect();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment