top of page
atlan logo green.png

Start a project

Start a project

Selected work
​

Practical guides on Wix Studio, Velo, Squarespace, e-commerce and SEO — written from real client projects.

​

​
Share Post

Keep reading

Journal

Hide Repeater Items with CMS Database Content

Writer: Atlan Design
Atlan Design
Dec 26, 2023
1 min read

Updated: Sep 19

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


Wix repeater showing and hiding elements based on CMS field content

$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


bottom of page