Can I change an element background color on a repeater, depending on what the repeater is showing? I am trying to use forItems or forEachItem but can not make it work. Below is my formula. I start with the element Hidden on Load. Then this:
$w.onReady(function () {
$w(“#dataset1”).onReady( () => {
$w(“#repeater1”).forEachItem( ($w, itemData, index) => {
if($w(“#text32”) === “Baltimore” ){
$w(“#vectorImage1”).show;
}
else {
$w(“#vectorImag2”).show;
}
} );
} );
} );
Can you please help. I am basically trying to show a box “vectorImage1” around a text when it says Baltimore, if its not that then another figure “vectorImage2”. If there is another way, please help!!
Hello
you got it almost right but there’s some little mistakes in the code:
$w.onReady(function () {
$w("#dataset1").onReady(() => {
$w("#repeater1").forEachItem(($w, itemData, index) => {
if ($w("#text32").text === "Baltimore") {
$w("#vectorImage1").show();
} else {
$w("#vectorImag2").show();
}
});
});
});
Best
Massa
Thanks Massa!! It works now
Massa, an additional question about this, is that I want to 'count" how many correct or incorrect inputs the user makes. #vectorImage1 = correct and #vectorImage2 = incorrect. How can I add another line to the formula to keep continues COUNT of correct or incorrect (since I will apply the same logic to same element beside #text32 ) ?
Hi Calvojose,
Can you please post your question in a new thread?
Roi.