Search.../

onBlur( )

Adds an event handler that runs when the element loses focus.

Description

An element loses focus (blurs) through user actions, such as clicking and tabbing, or programmatically, using the blur() function.

You can also define an event handler using the Properties and Events panel.

Note: onBlur() has no effect when applied to RadioButtonGroup elements.

Syntax

function onBlur(handler: EventHandler): Element
handler: function EventHandler(event: Event): void

onBlur Parameters

NAME
TYPE
DESCRIPTION
handler

The name of the function or the function expression to run when the element loses focus.

Returns

The element on which the event is now registered.

Return Type:

EventHandler Parameters

NAME
TYPE
DESCRIPTION
event

The event that occurred.

Returns

This function does not return anything.

Return Type:

void
Mixed in from:$w.FocusMixin

Related Content:

Was this helpful?

Get the ID of the element that has lost focus

Copy Code
1$w("#myElement").onBlur( (event) => {
2 let targetId = event.target.id; // "myElement"
3});