Visibility of site element based on dataset

I am using dynamic pages and I would like to have a button on my site that pulls a link from the dataset. The issue is that not all the items in the dataset will have a link.
Is there a way to write a code to only display the button with link from dataset if there is a link present in the dataset for it to pull?

Thanks in advance!

Yes this is possible.

Let’s say your LINK-DATA is inside of your database and the ID of the DB-FIELD is - → “url”.

Something like that…

$w.onReady(()=>{
	$w('#dynamicDataset').onReady(()=>{
		let currentItemData = $w('#dynamicDataset').getCurrentItem(); 
		console.log("LINK: ",  currentItemData.url);
		
		if(currentItemData.url) {$w('#myButtonIDhere').show();}
		else {$w('#myButtonIDhere').hide();}
	});
});