Search.../

onFocus( )

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

Description

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

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

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

Authorization

Request

This endpoint does not take any parameters

Response Object

The element on which the event is now registered.

Returns an empty object.

Status/Error Codes

Related Content:

Was this helpful?

Get the ID of the element that has received focus

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