Answers for "for keyboard press js"

10

html onkeypress

<input type="text" onkeypress="myFunction()">
Posted by: Guest on July-10-2020
3

js keyboard input

document.addEventListener('keydown', function(event) {
    if(event.keyCode == 37) {
        alert('Left was pressed');
    }
    else if(event.keyCode == 39) {
        alert('Right was pressed');
    }
});
Posted by: Guest on August-17-2020

Browse Popular Code Answers by Language