Possible to show & hide a elements on a specific dynami page

I was wondering if their’s a way to show & hide elements on a specific dynamic page from it’s url. I made the code below and was wondering if I’m on the right track? I’m using this page for reference wix-location-frontend - Velo API Reference - Wix.com

$w.onReady(function () {
	if (wixLocation.prefix === `/Item/5cd3c60e-3181-44bf-854f-5ddc8a6eabee`) {
	$w('#dropdown1').show();
	$w('#text1').show();
	$w("#dropdown1").options = [{"label": "Who's on first!", "value": 1},  {"label": "What's on second", "value": 2},  {"label": "I Don't Know is on third", "value": 3} ];
	
} else{
	($w('#dropdown1').hide());
	$w('#text1').hide();
}
});

you’re on the right track.
I suggest you use this instead:

 if (wixLocation.url.includes("5cd3c60e-3181-44bf-854f-5ddc8a6eabee") 
 { ... }

it will search for the GUID in the entire URL not just the prefix.

good luck

No matter what, I can’t get the code run… The unexpected error alert keeps appearing.

$w.onReady(function () {
	if (wixLocation.url.includes("5cd3c60e-3181-44bf-854f-5ddc8a6eabee")
	{
	($w('#dropdown1').show());
	($w('#text1').show());
	}
});

Just add a closing parenthesis:
if (wixLocation.url.includes(“5cd3c60e-3181-44bf-854f-5ddc8a6eabee”) )
This should do the job for you.

Have fun,

Yisrael

Thanks it worked

Hello, I was wondering if you could help me with similar code?
On a Dynamic page, I want a button to appear only when the connected data has something in the linked dataset field cell.
I am a beginner with wix coding and don’t really know how to use it to my advantage.
Based on your example above, I started with this but i know i am missing major parts or not using the right codes:

$w.onReady( function () {
if (wixLocation.url.includes(“#MyDynamicPage”)) {
$w(‘#CateringButton’).show();
* I only want the #CateringButton to show if the field in the database that it is connected to has a full cell (non empty cell). If the Cell is empty on certain /DynmaicPage/(Title) I dont want the button to show.

} else {
($w(‘#CateringButton’).hide();

});

Can someone help me out, i’m confusing myself. I know what i want the end result to be i just don’t know how to get there… :frowning: