Hide any element on a dynamic page when field is empty

Is there a way to hide any element that has an empty field on a dynamic page? In particular, I have a video that I’d like hidden when there is no URL in the field, but I would like to have it work on all fields. I am not a coder, so I will need detailed instructions.

  1. A dynamic-page always shows JUST-ONE-ITEM.
  2. This item is always loaded out of your DATABASE.
$w.onReady(()=>{
	$w("#myDynamicDataset").onReady( () => {
		let itemData = $w("#myDataset").getCurrentItem();
		console.log(itemData);
		console.log(itemData._owner);
		console.log(itemData._id);
		console.log(itemData.title);
	});
});

Example: Let’s say you have 3 different TEXT-ELEMENTS on your page …

  1. Text-Element-1 - - → showing - - - > OWNER-ID.
  2. Text-element-2 - - → showing - - - > ITEM-ID.
  3. Text-element-3 - - → showing - - - > TITLE.
$w.onReady(()=>{
	$w("#myDynamicDataset").onReady( () => {
		let itemData = $w("#myDataset").getCurrentItem();
		console.log(itemData);
		console.log(itemData._owner);
		console.log(itemData._id);
		console.log(itemData.title);
		
		$w('#myText-Element1').text = itemData._owner;
		$w('#myText-Element2').text = itemData._id;
		$w('#myText-Element3').text = itemData.title;
	});
});

Still something missing right?

$w.onReady(()=>{
	$w("#myDynamicDataset").onReady( () => {
		let itemData = $w("#myDataset").getCurrentItem();
		console.log(itemData);
		console.log(itemData._owner);
		console.log(itemData._id);
		console.log(itemData.title);
		
		if(itemData._owner) {
			$w('#myText-Element1').show();
			$w('#myText-Element1').text = itemData._owner;}
		else {$w('#myText-Element1').hide();}
		
		if(itemData._id) {
			$w('#myText-Element2').show();
			$w('#myText-Element2').text = itemData._id;}
		else {$w('#myText-Element2').hide();}
		
		if(itemData.title) {
			$w('#myText-Element3').show();
			$w('#myText-Element3').text = itemData.title;}
		else {$w('#myText-Element3').hide();}
	});
});

Thank you! Am I understanding correctly that I would have to add that if-else section of code for each element on the page?

Yes!

But if you have 1000-elements, you maybe should use a LOOP.

-for-loop
-each-loop