You are here: Reference > JavaScript > client-side > event handling > events > onkeyup

onkeyup event | keyup event

Browser support:
Occurs on an element that has the focus when the user releases a key.
  • Use the onkeydown and onkeypress events to receive a notification when a key is pressed or while a key is being held down.
  • To get the released key, use the keyCode and which event properties.

How to register:

<ELEMENT onkeyup="handler">

In JavaScript:
object.onkeyup = handler;
object.addEventListener ("keyup", handler, useCapture);
object.attachEvent ("onkeyup", handler);
You can find the related objects in the Supported by objects section below.
The event object is accessible to all event handlers in all browsers. The properties of the event object contain additional information about the current event. To get further details about these properties and the possible event handler registration methods, please see the page for the event object.
For a complete list of events, see the page for Events in JavaScript.

Basic information:

Bubbles Yes
Cancelable No
Event object KeyboardEvent

Actions that invoke the onkeyup event:

  • Releasing a key.

The order of events related to the onkeyup event:

Example HTML code 1:

This example illustrates the use of the onkeyup event:
    <script type="text/javascript">
        function GetChar (event){
            var keyCode = ('which' in event) ? event.which : event.keyCode;
            alert ("The Unicode key code of the released key: " + keyCode);
    <input size="40" value="Write a character into this field!" onkeyup="GetChar (event);"/>
Did you find this example helpful? yes no

Supported by objects:

Related pages:

External links:

User Contributed Comments

Post Content

Post Content