J
J
Jesse Pinkman2021-06-17 11:01:01
JavaScript
Jesse Pinkman, 2021-06-17 11:01:01

How to "reconnect" MutationObserver?

There is this markup:

<div class="container" id="container" contenteditable>
  blabla
</div>


The function is obs_containerto watch the container change.

If you click on the "add main" button, the main div is added to the container.

I need to keep track of container while there is no main. but if main is. then stop monitoring container and start monitoring only main and vice versa if there is no main.

How can I do that ? Of course, you can call the desired function on the button, but I would like to check the

DEMO in the observer itself

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question