Javascript – Pure Javascript listen to input value change


Is there any way I can create a constant function that listens to an input, so when that input value changes, something is triggered immediately?

I am looking for something using pure javascript, no plugins, no frameworks and I can't edit the HTML.

Something, for example:

When I change the value in the input MyObject, this function runs.

Any help?

Best Answer

This is what events are for.

HTMLInputElementObject.addEventListener('input', function (evt) {
Related Question