Hi There
On my website I have a repeater and inside the repeater I have a list of buttons
All the buttons are the same colour but I would like to change the colour of a button to red when the text displays “sold out”. I wanted to know if there was a code to help achieve this. I have attached some images to help
Thanks
Yes there is a code.
You can adjust the colours based of a field in the CMS.
Some new CMS will allow a colour field, some older collections wont and require code
adjust the below to suit
function applyBoxStyles() {
$w('#repeater').forEachItem(($item, itemData) => {
const status = itemData.fieldname;
const box = $item('#box');
const statusText = $item('#statusText');
switch (status) {
case "Field Text":
bgColor = "#000000";
textColor = "#000000";
break;
}