The keyboardEvent code property in HTML represents a physical key on the keyboard. It is used to return the key that triggers the event.
Return Value: It returns a string which represents which key is pressed.
Example 1: With KeyDown Event
Example 2: With KeyPress Event
Example 3: With KeyUp Event
Supported Browsers: The browser supported by keyboardEvent code property are listed below:
- Apple Safari 10.0
- Google Chrome 48.0
- Firefox 32.0
- Internet Explorer Not supported
- HTML | KeyboardEvent which Property
- HTML | DOM KeyboardEvent key Property
- HTML | DOM keyboardEvent charCode Property
- HTML DOM | KeyboardEvent altKey Property
- HTML | DOM KeyboardEvent metaKey Property
- HTML | DOM KeyboardEvent keyCode Property
- HTML | DOM KeyboardEvent location Property
- HTML | DOM KeyboardEvent shiftKey Property
- HTML | DOM KeyboardEvent
- HTML | DOM KeyboardEvent getModifierState() Method
- HTML | <code> Tag
- HTML | DOM Code Object
- HTML | <applet> code Attribute
- HTML | Computer Code Elements
- HTML | DOM URL Property
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.