onkeyup event | keyup event
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:
In HTML:
In JavaScript:
<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:
- onkeydown
- onkeypress
- onkeyup
Example HTML code 1:
This example illustrates the use of the onkeyup event:
|
||||
<head> <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); } </script> </head> <body> <input size="40" value="Write a character into this field!" onkeyup="GetChar (event);"/> </body> |
||||
|
||||
Did you find this example helpful?
|
Supported by objects:
document, window
HTML elements:
a, abbr, acronym, address, applet, area, b, bdo, big, blink, blockquote, body, button, caption, center, cite, code, dd, del, dfn, dir, div, dl, dt, em, embed, fieldset, font, form, h1, h2, h3, h4, h5, h6, hr, html, i, img, input:button, input:checkbox, input:file, input:image, input:password, input:radio, input:range, input:reset, input:search, input:submit, input:text, ins, isindex, kbd, keygen, label, legend, li, listing, map, marquee, menu, nobr, noframes, object, ol, p, plaintext, pre, q, rt, ruby, s, samp, select, small, span, strike, strong, sub, sup, table, tbody, td, textarea, tfoot, th, thead, tr, tt, u, ul, var, xmp
Related pages:
External links:
User Contributed Comments