Search...
at( )
Gets a selector function for a specific context.
Description
The at()
function returns a scoped selector where the scope is based on the
context property. Usually, you will use at()
in a event handler that handles
events fired on an element contained in a repeater to get a selector with
repeated item scope. The returned function
selects the elements from the same repeater item where the event was fired.
Syntax
function at(context: EventContext): $w
at Parameters
NAME
TYPE
DESCRIPTION
context
EventContext
An event context.
Was this helpful?
Select an element in a repeated item
In this example, we have a repeater where each item contains an image and a text element. When an image is clicked, the value of the text element in the same repeated item is changed to "Selected". All the other text elements in the other repeated items are not affected.
Copy Code
1$w.onReady( function () {2 $w("#myRepeatedImage").onClick( (event) => {3 let $item = $w.at(event.context);4 $item("#myRepeatedText").text = "Selected";5 } );6} )