Dynamic buttons to different Dynamic item templates.


Hello, I am currently very new to Wix coding (in fact this is my first time doing this).

My issue is that I have a dynamic list page which I captured a picture of. The elements follow the Dynamic Collection as shown.
Now my collection has a Tall_or_Wide_Banner field, which is labelled either W or T.

I want to make the code so that if the user clicks on one of the buttons (labelled as Read More), the code will check if the field contains W or T, then load up the correct dynamic item page. So e.g. if the field is W, it will direct the user to Events_List W (Item).

This is the code I have now, but clicking on the button does absolutely nothing currently. So some help is appreciated, thanks.


	//Check if banner image is T or W. 
	//If T, send to page Event_List(item).
	//If W, send to page Event_List(item2).
	console.log("EEEEEEEEEEEEEEEEEEEEEEEEEEEEEEEE");

	let tw;
	let nameEvent;
	$w("#button1").onClick(()=> 
	{
		console.log("clicked");
		const objectID =  $w("#dynamicDataset").getCurrentItem()
		wixData.get("Items",objectID).then((item) =>{
			tw = item.tallorWideBannerImage;
			nameEvent = item.title;
		})

		if(tw == "T"){
			wixLocation.to("events-list-1/t/"+nameEvent);
		}
		if(tw == "W"){
			wixLocation.to("events-list-1/w/"+nameEvent);
		}

	}