Editor X: How to Disable a button in a repeater and Enable other buttons when CLICKED?

Hi guys, I’ve been struggling with this for a while now. :hushed:

So my repeater has buttons connected to a database (via label). When a button is clicked it loads a video URL onto a video player. THAT WORKS GREAT! :blush:

But what I want is that, when I click on a button it disables to indicate that its corresponding video URL has been loaded onto the video player, and then the other buttons should be enabled. In brevity, only one button should be disabled at a time in the repeater.

Here’s my code

$w.onReady(function () {

    $w("#repeater1").onItemReady(($item, itemData, index) => {
        $item("#button1").onClick(function (event) {

 let player = $w("#videoPlayer1");
 player.src = itemData.videoUrl;

 let selectedButonLabel = $item("#button1").label;
 let currentLabel = itemData.partLabel;
 const arrSelected = [];
 let disabledBtn = $item("#button1").enabled;

 arrSelected.push(selectedButonLabel).toString()

 Check();

 function Check() {
 let sameLab = selectedButonLabel = currentLabel;

 if (sameLab == false && disabledBtn == true) {
                    $item("#button1").disable()
                } else if (sameLab && disabledBtn == false) { $item("#button1").disable() }

            }

        });

    });

});

I appreciate any responses. Thank you greatly in advance. Cheers!

Walter.

SOLVED!

$w.onReady(function(){

$w("#dataset1").onReady(function(){

let selectedButton ='';

$w('#repeater1').forEachItem(($item, itemData, index)=>{
$item("#button1").onClick(()=>{

let player =$w("#videoPlayer1");                 

player.src = itemData.videoUrl;
$item("#button1").disable();

if(selectedButton !==''){                    

 selectedButton.enable();

}                  

selectedButton =$item("#button1");

		});
	});
});