Answers for "add event listener to keyboard js"

0

adding event listener keypress event in javascript

let msg = document.getDocumentById('#message');

msg.addEventListener("keydown", (event) => {
    // handle keydown
});

msg.addEventListener("keypress", (event) => {
    // handle keypress
});

msg.addEventListener("keyup", (event) => {
    // handle keyup
});
Posted by: Guest on November-18-2020
-1

event listener js keydown not working

window.addEventListener("keydown", function(e){}, true);
//true makes it work
Posted by: Guest on December-20-2020

Code answers related to "add event listener to keyboard js"

Browse Popular Code Answers by Language