In this lesson, you will learn how to use CMS Database content to control what elements show in repeaters.
$w.onReady(function () {
$w('#dataset1').onReady(() => {
$w('#repeater1').onItemReady(($item, itemData) => {
let sTitle = itemData.specialTitle;
if (sTitle === "" || sTitle === null || sTitle === undefined)
$item("#badge").hide();
} else {
$item("#badge").show();
}
})
})
});
For this Velo code to run properly on your website, you either need to name your dataset to "dataset1" or change the code to match the name you provided to it. Same goes for the Repeater, badge, and lastly, make sure you use the correct Field Key from your database.
Have Fun!
Comments