UIEvent.isChar

Non-standard
This feature is non-standard and is not on a standards track. Do not use it on production sites facing the Web: it will not work for every user. There may also be large incompatibilities between implementations and the behavior may change in the future.

The UIEvent.isChar read-only property returns a Boolean indicating whether the event produced a key character or not.

Some key combos may raise events but not produce any character (example: ctrlalt?). When this is the case, isChar returns false. It is used when event handlers need to do something like echo the input on the screen.

Syntax

JavaScript
bool = event.isChar;

Example

JavaScript
if (e.isChar) {
   console.log(e.type);
}

Specification

This property is not part of any specification.

License

© 2016 Mozilla Contributors
Licensed under the Creative Commons Attribution-ShareAlike License v2.5 or later.
https://developer.mozilla.org/en-us/docs/web/api/uievent/ischar

API DOM Property Read-only Reference Référence UIEvent