top of page

Hiding Content When There is No Content

Code is below


$w.onReady(() => {
    $w("#dynamicDataset").onReady(() => {
  // Gets the current item properties and stores them in a variable called item
        const item = $w("#dynamicDataset").getCurrentItem();
        // Checks if the current item has a value in the "video" field
        if (!item.video) {
        // Collapses the video player if there is no value for "video"
            $w("#videoBox1").collapse();
        }
        if (!item.photo) {
        // Collapses the image if there is no value for "photo"
            $w("#imageX2").collapse();
        }
        if (!item.document) {
        // Collapses the button if there is no value for "document"
            $w("#button3").collapse();
        }
        if (!item.email) {
        // Collapses the text field if there is no value for "email"
            $w("#text18").collapse();
        }
        if (item.boolean) {
        // Collapses the section if there IS a value for "Hide Section"
            $w("#section14").collapse();
        }
    });
}); $w.onReady(() => {

As seen on:

A global community of cross-disciplinary designers, from web and UI/ UX to product design

A global community of cross-disciplinary designers, from web and UI/ UX to product design

A community for professional web designers and agency founders who want to double their business without doubling their efforts

A community for professional web designers and agency founders who want to double their business without doubling their efforts

Connect with experienced freelancers for free guidance and feedback.

Connect with experienced freelancers for free guidance and feedback.

A professional space for marketing professionals to learn and grow their business

A professional space for marketing professionals to learn and grow their business

A community for web developers looking for the newest tools in web design

A community for web developers looking for the newest tools in web design

See More Videos

bottom of page