Search.../

onItemClicked( )

Adds an event handler that runs when an item in a quick action bar is clicked.

Deprecation note: The $w parameter of event handlers is being deprecated. To get a scoped selector for working with elements in repeater items, use the $w.at() function and pass it the context property of the event parameter: $item = $w.at(event.context). To learn more, see here.

Syntax

function onItemClicked(handler: QuickActionBarItemClickedEventHandler): QuickActionBar
handler: function QuickActionBarItemClickedEventHandler(event: QuickActionBarItemClickedEvent, $w: $w): void

onItemClicked Parameters

NAME
TYPE
DESCRIPTION
handler

QuickActionBarItemClickedEventHandler

The name of the function or the function expression to run when a quick action bar item is clicked.

Returns

The quick action bar that triggered the event.

Return Type:

QuickActionBarItemClickedEventHandler Parameters

NAME
TYPE
DESCRIPTION
event

QuickActionBarItemClickedEvent

The event that has occurred.

$w

$w

Deprecated: A selector function. The $w function was used to enable event handlers to work with elements in repeaters. Now, to get a scoped selector for working with repeater items, use the $w.at() function and pass it the context property of the event parameter: $item = $w.at(event.context).

Returns

This function does not return anything.

Return Type:

void

Was this helpful?

Get the information of the item that was clicked

Code Example

Copy Code
1$w("#myQuickActionBar").onItemClicked( (event) => {
2 let itemType = event.item.itemType; // "search"
3 let itemLabel = event.item.label; // "Search"
4 let itemLink = event.item.link; // "https://www.google.com/search?q=wix"
5
6 let imageSrc = event.itemIndex; // 3
7} );