Search.../

onChange( )

Adds an event handler that runs when the tabs element moves to a different tab.

Description

onChange() runs when the tabs element moves to a different tab. This occurs when you call the changeTab() function or when a site visitor clicks on a tab menu item.

Syntax

function onChange(eventHandler: EventHandler): void
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 tabs element moves to a different tab.

Returns

This function does not return anything.

Return Type:

void

EventHandler Parameters

NAME
TYPE
DESCRIPTION
event

The event that occurred.

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

Get the label of the tab to which the tabs element moved

Copy Code
1$w("#myTabsElement").onChange((event) => {
2 let currentTabLabel = event.target.currentTab.label; // "Second Tab"
3});