Answers for "javascript e.key"

1

execute JS code after pressing space bar

document.body.onkeyup = function(e){
    if(e.keyCode == 32){
        //your code
    }
}
Posted by: Guest on June-19-2020
1

javascript e.key

document.inputDiv.addEventListener('keyup', (e) => {
	console.log(e.key);
});

// Typing 'hello world' will log --> 'h' 'e' 'l' 'l' 'o' ' ' 'w' 'o' 'r' 'l' 'd';
Posted by: Guest on February-11-2021

Code answers related to "Javascript"

Browse Popular Code Answers by Language