Hello guys,
I’m learning to use repeaters.
my first repeater and a repeater not connected to any collection (it’s not the most correct use but I’m trying to learn by steps)
Now I have created 5 containers.
I put a click event to figure out which container I’m selecting but I do not know how to do it. In the sense that they all have the same id
How can I do? someone helps me
This is my code:
export function container4_click(event) {
let targetId = event.target.id;
console.log('targetId - ' + targetId);
}
Thanck you
Hi,
Indeed all containers have the same ID, because for each repeater slide, there’s only one container.
In the click event, you should have a second parameter next to the “event” parameter called “$w”. (I don’t know why in your function it’s not there, you can add it yourself, see my code below for an example).
This special $w will allow you to select the element that belongs to the repeater slide being interacted.
For example, I have a button called “button1” in my repeater. It is repeated 3 times (3 repeater slides).
This is the click event for the button:
export function button1_click(event, $w) {
$w("#button1").disable()
}
Note the second function parameter $w.
When the button is clicked, I disable it. This will disable only one button, the one I clicked.
This special $w is called a scoped $w, because its actions are scoped to the repeater slide you interacted with.
I hope that made sense 
Give it a try and see if it works for you as well.