Display dropdown list result in textbox

I created two dropdown lists with one storing a set list of member names and one that stores a set list of member phone numbers. I’m trying to have the values that users selected for each show up as text (displayed to all visitors of the website). I tried to use the “selected” property per the Wix API but get an error saying “selected does not exist on dropdown2”. Here is the code for this portion:

let w1name = $w(‘#dropdown2’).selected
$w(‘#text59’).text = w1name
let w1number = $w(“#dropdown1”).selected;
$w(‘#text60’).text = w1number

Any ideas? Thanks in advance!!

Hey
Whatever you try to do in Wix Code always have the API Reference page open and look at the properties you have on the object you are using.

If you look at the dropdown in the API you will see that the selected values is exposed as .value on the dropdown.

I hope this will be of value for you and if you like the answer please mark it as Top Comment so others can find the solution faster.

Happy coding!