1
<input id="in" type="text">

<script>
var input = document.getElementById("in");

input.oninput = function () {
    console.log("input");
};

input.onchange = function () {
    console.log("change");
};

setTimeout(function () {
    input.value = "test"
}, 5000);
</script>

No events worked.

How to detect input value change using JavaScript?

niutech
  • 27,241
  • 15
  • 90
  • 102
andrei_sharov
  • 119
  • 11

0 Answers0