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

102
Views
Listen for text changes in all elements with specific class name

I'm trying to run a function the moment text inside any div with a specific class name changes.

See my code below. Here I am trying to listen for text changes in all elements with the class name of "my-item". For some reason this isn't working and I can't figure out what I'm doing wrong.

var TargetItem = document.querySelectorAll(".my-item");
TargetItem.forEach((TargetItemEach) => {
    var TargetText = TargetItemEach.innerHTML;
    TargetText.addEventListener("change", RunMyScript);
}); 
        
function RunMyScript() {
   alert('Hello');
}
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!