You are here: Reference > JavaScript > client-side > event handling > properties > isChar (event)

isChar property (event)

Browser support:
Returns whether the character that belongs to the current event is a key character or not.
Returns inconsistent values (always false)! Do not use this property. Check the value of the cross-browser keyCode property to determine whether a valid key was pressed.


You can find the related objects in the Supported by objects section below.
This property is read-only.

Possible values:

Boolean that indicates whether the character is a key character or not.
One of the following values:
The character is not a key character.
The character is a key character.
Default: false.

Example HTML code 1:

This example illustrates the use of the isChar property:
    <script type="text/javascript">
        function IsKeyChar (e) {
            var msg = (e.isChar)? "Key character was pressed." : "Not a key character was pressed."; 
            alert (msg);
    <input type="text" onkeypress="IsKeyChar (event);" value="Press any key"/>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content