KeyboardEvent Value (keyCodes, metaKey, etc)

Submitted by:J Kamy81

Date added:29 July, 2019

Category:JavaScript

When a KeyboardEvent fires, you can test which key was pressed because that event contains information you can write logic against.

Tags: keyboard event

Code Snippet:


JavaScript

document.addEventListener("keydown", function(event) {
console.log(event.which);
})
 
 

Comments