I am trying to develop a Chrome extension which replaces certain HTML in a list of elements that updates itself with time, but I can't find the right way to do it.
I have tried the following:
console.log("Getting nodes...")
var f = document.getElementsByClassName("myClassName")
function watch(data) {
alert("Changed!!")
}
var observer = new MutationObserver(watch);
observer.observe(f.childList, {childList: true});
But I get the following error:
Uncaught TypeError: Failed to execute 'observe' on 'MutationObserver': parameter 1 is not of type 'Node'.
Am I missing something? Perhaps there's a better way? Any help will be much appreciated!