I’d like to find a way to remove a button depending on if an item in my database has a link in one of it’s columns.
For what I want, if an item has a link associated with it, then the button in the repeater would not show up. If there is a link, then the button would show with “Visit Website” and take you to the certain website.
I know how to work with dev mode on Wix, but I’m not talented in coding myself, so help is needed!
Thanks!
You can check if there is any value in the field or not. Then link the button to that link
#myRepeater - repeater
#button1 – button in the repeater.
websiteLink – field of the url in the database
$w("#myRepeater").onItemReady(($item, itemData, index)=>{
if (!itemData.websiteLink){
$item("#button1").collapse();
}
else {
$item("#button1").expand();
let link = itemData.websiteLink;
$item("#button1").link= `link`;
}
});
Reference - onItemReady - Velo API Reference - Wix.com
This didn’t work. It didn’t collapse any of the buttons without links. What else can I try?
@gbywaterschuyler What is your code ???
@gbywaterschuyler Is websiteLink the field key of your link in the database ???