Answers for "listen to all events on an html element"

0

listen to all events on an html element

var img = document.querySelector("#img_div img"),
observer = new MutationObserver((changes) => {
  changes.forEach(change => {
      if(change.attributeName.includes('src')){
        console.dir(img.src);
      }
  });
});
observer.observe(img, {attributes : true});
Posted by: Guest on September-13-2021

Code answers related to "listen to all events on an html element"

Browse Popular Code Answers by Language