javascript Club
cadastrar-se
Fanpop
New Post
Explore Fanpop
In this post, you can test yourself on which key you were pressed. When you get this event contains all the event information that you might need to write your own code.

Sometimes you need to prevent some keyboard key operations like prevent to select all text, copy, paste, etc. At that time you need to write a JavaScript keyboard event function to handle it as per your need.

link
The following JavaScript code, when a keypress event fires, you will get all event properties. For example, when you pressing “1”, you will get “49” value. It is recommended to write logic on an event.which instead of event.keyCode and event.charCode.