Windows apps
Collapse the table of content
Expand the table of content
Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

charCode property

Gets the numeric key code of a key that is pressed.

Internet Explorer 9

 

Syntax

JavaScript

p = object.charCode

 

Property values

Type: Integer

The numeric code of the key that is pressed.

Standards information

There are no standards that apply here.

Remarks

The charCode property represents the character code during the onkeypress event and the unmodified scan code of the key during onkeydown and onkeyup events. To detect whether the Alt, Ctrl, Meta, or Shift key is also pressed, see the altKey, ctrlKey, metaKey, or shiftKey property of the event.

The charCode property is provided for compatibility only. The latest version of the Document Object Model (DOM) Events specification defines a key property instead.

See also

KeyboardEvent
Reference
char
key
keyCode
which

 

 

Show:
© 2017 Microsoft