Detect potential DOM changes


Ask A Question





Login To post a question

I have one div element that has one p inside it

<div id='main'>
  <p>1</p>
</div>

and there is going to be some changes on that div element, one more p is going to be appended inside it, and will look something like this:

<div id='main'>
  <p>1</p>
  <p>2</p>
</div>

Is there a method or library that will prompt/alert me when there is going to be some changes inside DOM, like in this case, one element to be appended? I want to be prompted/asked something in this manner:

“There is going to be DOM changes inside main div, p element will be appended. Do you want to approve or discard this change to the DOM?”

I know about Mutation Observer, but that only logs when something already changed into the DOM, right? You can’t intercept the DOM changes with Mutation Observer, because, it logs only what and where changes already occurred, and not, that will happen?

For more info please click herehttps://stackoverflow.com/q/50375026



Have a question or need a custom quote?
info@smartinfocare.com