KeyboardEvent charCode Property

Example

Get the value of the pressed keyboard key:

let value = event.charCode;
Try it Yourself »

Description

The charCode property returns the character code when a keybord event occurs.

The charCode property is read-only.

Warning !

The charCode property is deprecated.

Use the key property instead.


Syntax

event.charCode

Technical Details

Return Value: A Number
The character code
DOM Version: DOM Level 2 Keyboard Events.

Copyright 1999-2023 by Refsnes Data. All Rights Reserved.