Hide text if field is empty

I am new to wix and not having much luck finding answers or understanding the post I have came across. I need to hide a text element if the field in a dataset is empty.

The favSkinTreatmentfield is linked to my Teams Dataset. If the team member has field in that data it would show

Favorite Skin Treatment: Facial

If the team member didn’t have a response for their favorite skin treatment I would like to hide the text “Favorite Skin Treatment”

// For full API documentation, including code examples, visit https://wix.to/94BuAAs

$w.onReady(function () {
 //TODO: write your page related code here...

 if ($w('#favSkinTreatmentfield').text === ""); {
                $w('#text29').hide();
            }
elseif {
                    $w('#text29').show();

                }

}
});

Hi Thomas,

There is also a dataset onReady function that you would need to put this inside of if you want to execute this code when the page loads.

$w.onReady( () => {
  $w("#dataset1").onReady( () => {
 	if ($w('#favSkinTreatmentfield').text === "") {
              $w('#text29').hide();
        } else {
              $w('#text29').show();
        }
  } );
} );

I appear to be doing something wrong still. The name of my collection is Team but what I am getting is an error message saying invalid selector…

$w.onReady(function () {
 //TODO: write your page related code here...

$w.onReady( () => {
  $w("#Team").onReady( () => {
 if ($w('#favSkinTreatmentfield').text === "") {
              $w('#text29').hide();
        } else {
              $w('#text29').show();
        }
  } );
} );


});

Hi, this question was asked so many times, you’ll find so many examples and posts related to this question if you searched the forum

In addition to Anthony’s example, here are two more examples:
hide certain elements on selected language site.
How do i hide button on dynamic page when collection field is empty or contain nothing?