Drop down menu for navigation

Hi guys I have no coding experience, apart from basic ‘if statements’ so maybe I’m completely out of my depth here.

Basically I want to create a drop down list and a button next to it so that customers can select a country from the list and then press the button to take them to one of my relevant web pages. I’m aware of the drag and drop menu but this won’t allow me to remove some of the menu items.

So so far I have added drop down list to my website which shows a selection of countries, that’s it …

Any help will be greatly appreciated.

Thanks!
Joubert

Hello Joubert,

What you have to do is add a onclick event to the button. This event takes the current value of the drop down and based on the value redirects them to one of your pages.

Onclick api
Getting selected value api
redirecting to pages api

It would look something like this:

$w.onReady(() => {
  $w('#exampleButton").onClick(() => {
    cont value = $w('#exampleDropDown').value();
    if(value === 'USA') {
      wixLocation.to('/location/USA')
    } if(...){
    ...
    }
  })
})

Goodluck!

Amazing ! Thanks so much, ill give it go.

I getting a fault with this line, its showing there is a problem with value,


Do need to assign a value ?
Thanks
J

@joubertdevilliers Hi,
Change the 8th line, instead of “cont” write “let”.