Changing a button link in a repeater

I have a dataset set up and linked to a repeater displaying a table of data, including a button with a link, on each item of the repeater.

On some items, there is a field a button (#button5) in the repeater and, if there is a label on that button, I want to erase the link on a different button (#button1). I need to selectively line by line in the table, so I am trying to use the onItemReady() function on the relevant repeater.

Shouldn’t the following work?

$w.onReady(function () {
    $w("#travel").onReady( () => {
        $w("#repeater1").onItemReady( ($item, itemData, index) => {
    
            if ($item("#button5").label != "Notes available") {
                $item("#button1").link = "";
            } 
            
        });
    });
});

Any light anyone can throw on this would be much appreciated!

Simon.

If the $item ( “#button1” ) is inside the same repeater item of the $item ( “#button5” ), then it will work as you described.

Remember that the .onItemReady() method is only called when you update the repeater’s data. Otherwise you should change that behavior using the .forEachItem() method.

Thanks Bruno…I switched to .forEachItem() and it’s working as I expected now.