Search.../

onChange( )

Adds an event handler that runs when an input element's value is changed.

Description

An element receives a change event when a user changes the value in an input element.

A change event is not triggered when you change an element's value using the element's value property.

Because onChange() is fired before validations are performed, do not check any of the validation properties in the onChange() event handler. For example, do not code an if statement that checks the valid property in the onChange() because the property at this point contains values prior to the onChange().

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

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

Was this helpful?

Get the value of the element that was changed

Copy Code
1$w("#myElement").onChange( (event) => {
2 let newValue = event.target.value; // "new value"
3});