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');
}