javascript onkeydown
snippet in javascript

javascript onkeydown

user5450

<input type="text" onkeydown="myFunction()">

javascript keydown

user4548

document.addEventListener("keydown", function(event) {
  if (event.keyCode == 32) {
    console.log("Space was pressed!");
  }
});

keydown events

user8137

eventTarget.addEventListener("keydown", event => {
  if (event.isComposing || event.keyCode === 229) {
    return;
  }
  // do something
});