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
  • 28,923
  • 15
  • 96
  • 106
andrei_sharov
  • 169
  • 2
  • 12

0 Answers0