Search.../

onKeyRelease( )

Adds an event handler that runs when the key is released within an input.

Description

You can also define an event handler using the Properties and Events panel. This will automatically add the required code for the selected element and event.

Notes:

  • Some browsers do not issue a key release event for certain keys, such as arrow keys or the shift key.

  • When you retrieve the value from the target property of a KeyboardEvent, you get the value of the target element before the key was released.

Syntax

function onKeyRelease(handler: KeyboardEventHandler): Element
handler: function KeyboardEventHandler(event: KeyboardEvent): void

onKeyRelease Parameters

NAME
TYPE
DESCRIPTION
handler

The name of the function or the function expression to run when the element is clicked.

Returns

The element to which the event handler was added.

Return Type:

KeyboardEventHandler Parameters

NAME
TYPE
DESCRIPTION
event

The keyboard event that occurred.

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

Print key released and event type

Copy Code
1$w('#myElement').onKeyRelease((event) => {
2 console.log(event.key); // Enter
3 console.log(event.type); // keyRelease
4});