0
Assuming I have a tag where values are changed commonly on my page, example:
<p id="valor"></p>
What I have to do in javascript without jquery to listen to this change all the time and perform an action with each change?
0
Assuming I have a tag where values are changed commonly on my page, example:
<p id="valor"></p>
What I have to do in javascript without jquery to listen to this change all the time and perform an action with each change?
0
Correction of comment, DOMSubtreeModified
was depreciated with the new builder MutationObserver()
you can start here:
var observer = new MutationObserver(callback);
take a look at the mozila link https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver/MutationObserver
Refe II: https://developer.mozilla.org/en-US/docs/Web/API/MutationObserver
Ref III: https://developer.mozilla.org/en-US/docs/Web/Events/DOMSubtreeModified
Browser other questions tagged javascript html5
You are not signed in. Login or sign up in order to post.
How the value of a paragraph will change constantly?
– Woss
in any click action I change the textContent of this p
– Francis Vagner da Luz
And can not perform the action in these click events?
– Woss
No, I need to listen to this change regardless of the click
– Francis Vagner da Luz
there is the event Domsubtreemodified that verifies change in the DOM without the use of a Timer, it will change when the content of the element changes, I think will suit you
– Hebert Lima
you have some example of him Hebert?
– Francis Vagner da Luz
A good reference https://blog.da2k.com.br/2015/02/07/javascript-assistindo-mudancas-no-dom-sem-timer/
– user60252