Using MutationObserver to listen for dom changes does not take effect

< H1 > using MutationObserver to listen for dom changes does not take effect < / H1 > < H2 > Environment < / H2 >
  • Windows 10
  • Chrome 71
< H2 > question < / H2 >

as mentioned, we want to listen for changes in the DOM tree of the page

the code is as follows

  MDN  

but in fact, the browser console doesn"t output anything! Is our method wrong?

Mar.11,2022

found an interesting phenomenon, that is, the output cannot be viewed with console.log, but a message box pops up with alert, indicating that it is in effect.

Menu