Listen and perform action

Asked

Viewed 31 times

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?

  • 1

    How the value of a paragraph will change constantly?

  • in any click action I change the textContent of this p

  • And can not perform the action in these click events?

  • No, I need to listen to this change regardless of the click

  • 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

  • you have some example of him Hebert?

  • A good reference https://blog.da2k.com.br/2015/02/07/javascript-assistindo-mudancas-no-dom-sem-timer/

Show 2 more comments

1 answer

0


Browser other questions tagged

You are not signed in. Login or sign up in order to post.