Answers for "detect keypress"

1

detect keypress

document.addEventListener("keypress", function onEvent(event) {
    if (event.key === "ArrowLeft") {
        // Move Left
    }
    else if (event.key === "Enter") {
        // Open Menu...
    }
});
Posted by: Guest on June-02-2021

Code answers related to "detect keypress"

Code answers related to "Javascript"

Browse Popular Code Answers by Language