Expand and collapse individual repeater elements

Hey Andrew.
Thanks for your reply! It seems like a very sleak solution.
When I implement it, however the action triggers all repeater elements at once. Is there a way to limit it only to the element in which the buttons are clicked?

As I’m working with a repeater, I pull the data from my dataset and automatically populate the various multi-state boxes in the repeater.

I found this solution via Chat GPT here, but so far haven’t gotten it to work yet.

$w.onReady(function () {
$w(“#repeater1”).onItemReady(($item, itemData, index) => {
const multiStateBox = $item(“#multiStateBox”);
const container = $item(“#container”);
const button1 = $item(“#button1”);
const button2 = $item(“#button2”);

    button1.onClick(() => { 
        multiStateBox.changeState("State 2"); 
        container.show(); 
    }); 

    button2.onClick(() => { 
        multiStateBox.changeState("State 1"); 
        container.hide(); 
    }); 
}); 

});

What do you think?