Monday, June 3, 2024
137
rated 0 times [  138] [ 1]  / answers: 1 / hits: 42465  / 13 Years ago, sun, september 11, 2011, 12:00:00

I need to intercept any changes in the content of a cell inside my webpage.



The following code shows me that addEventListener does not work.



function modifyText() {
alert(!);
}

var el=document.getElementById(mycell);
el.innerHTML=a
el.addEventListener(change, modifyText, false);
// After next instruction I expect an alert message but it does not appear...
el.innerHTML=Z;


The code is just a toy example. In my real case the changes in the page (and therefore in the cell, too) are made by a webapp that I have NO control over.


More From » addeventlistener

 Answers
10

You can't listen to a DOM element change that way. change event is mostly for inputs



There is some other new DOM 3 events that would help you on this.



Here is some:



DOMCharacterDataModified //Draft



DOMSubtreeModified


[#90153] Friday, September 9, 2011, 13 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
turnerf

Total Points: 620
Total Questions: 101
Total Answers: 109

Location: French Polynesia
Member since Tue, Jul 7, 2020
4 Years ago
turnerf questions
;