Connect drop down list to images

@russian-dima

Thanks very much. Everything seems to be ok except for Wix code the message below. I’ve included as snapshot of the code as it stands.

Wix code SDK Warning: The src parameter of “BackgroundSwatchImage” that is passed to the src method cannot be set to null or undefined. - I get this message for line 17.

$w.onReady( function () {

$w( ‘#BackgroundSwatches’ ).onChange(() => {

let selectedIndex =$w( ‘#BackgroundSwatches’ ).selectedIndex

$w( '#dataset3' ).getItems(selectedIndex,  1 ) 
        .then((result) => { 

let items = result.items;
let totalCount = result.totalCount;
let offset = result.offset;

//here your code what should now happen with your image

        $w( '#BackgroundSwatchImage' ).src = items.img  //img=the reference-id of your column where you store all your images 

        }) 
        . **catch** ((err) => { 

let errMsg = err.message;
let errCode = err.code;
});
})
})