Answers for "how do i listen to a keypress in javascript"

0

how do i listen to a keypress in javascript

let b = document.getElementById("body"); //making var for body
b.addEventListener("keydown", (evt) => {//when this happens
	console.log(evt.keyCode); //log keycode
});
Posted by: Guest on November-28-2020

Code answers related to "how do i listen to a keypress in javascript"

Code answers related to "Javascript"

Browse Popular Code Answers by Language