Open Site Navigation

Hide Repeater Items with CMS Database Content

In this lesson, you will learn how to use CMS Database content to control what elements show in repeaters.

Hide Repeater Items with CMS Database Content

Before you copy the code to your website, I highly suggest you watch our video to make sure your website is set up properly.



 

$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!


If you need assistance setting up the code for your website, we do offer a Velo service that may be able to help!