Search.../

onChange( )

Adds an event handler that runs when the multi-state box moves to a new state.

Description

onChange is fired when the multi-state box moves to a new state. This occurs when the changeState() function is called.

Syntax

function onChange(eventHandler: EventHandler): MultiStateBox
eventHandler: function EventHandler(event: Event): void

onChange Parameters

NAME
TYPE
DESCRIPTION
eventHandler

The name of the function or the function expression to run when the multi-state box moves to a new state.

Returns

The multi-state box 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

Related Content:

Was this helpful?

Get the ID of the state to which the multi-state box moved

Copy Code
1$w("#myStatebox").onChange( (event) => {
2 let currentState = event.target.currentState.id; // "state2"
3} );