Linking an image to a dropdown

Hi

I’m trying to get a product image to display depending on which element is picked from the dropdown (the dropdown label is the product name and the dropdown value is the productId).

Is there a way to do this?

I need it to display in the lightbox accessed by clicking “write a review” from the main page at www.marlenasfeather.com

I’ve tried to use this code but the “Stores/Product” database is not linking here, but to be perfectly honest I got a template code from another post and don’t fully understand it.


export function productChoice_change_1(event) {
 const indexOfItem = event.target.selectedIndex;
    $w("Stores/Products").getItems(indexOfItem, 1) 

        .then((results) => {

 let yourItem = results.items;

            $w('#image1').src = yourItem[0].mainMedia;

        });
}