javascript input onchange get value

JavaScript
document.getElementById('my-select').addEventListener('change', function() {
  console.log('You selected: ', this.value);
});var element = document.getElementById("myInput");
element.onchange = function() {
  console.log(element.value);
}onchange is only triggered when the control is blurred. Try onkeypress instead.
Source

Also in JavaScript: