Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

138
Views
How to stop a MutationObserver observing a single target?

To move this old mutation event jQuery code

$('#container .class').on('DOMNodeInserted.mynamespace', 'input[type="number"]', function (e) {
  ...
  $(this).closest('#container .class').off('DOMNodeInserted.mynamespace');
});

to MutationObserver, I have to add the observer to multiple elements at once:

var observer = new MutationObserver(function (mutations, observer) {
  ...
});
var config = {
  subtree: true,
  childList: true
};
$("#container .class").each(function () {
  observer.observe(this, config);
});

But how can I similarly remove the observer from a single element at a time (after the first time the event/observer runs successfully) to retain the behaviour of the pre-MutationObserver version?

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!