Hi! I’m trying to link the dropdown menu options to different pages on my wixsite. The problem I encounter is that it only goes to the pages after the second time I change an option.
For example: the values in the dropdown are:
- “French”
- “English”
- “German”
(All three are linked to a different wix page.)
whenever I change to for example: “English” , nothing happens…
When I then change to “french”, “English” opens…
It looks like it only works on the second click. Here is the code that I used. Does anybody know what is going wrong here? Thanks a lot!
export function dropdownLanguage_change(event) {
//Add your code for this event here:
let filterLanguage = $w(‘#dropdownLanguage’).value;
$w('#dropdownLanguage').onChange(() => {
if (filterLanguage === ‘frances’) {
wixLocation.to(“/frances”);
}
if (filterLanguage === ‘aleman’) {
wixLocation.to(“/Aleman”);
}
if (filterLanguage === ‘espanol’) {
wixLocation.to(“/Espanol”);
}
if (filterLanguage === ‘ingles’) {
wixLocation.to(“/Ingles”);
}
if (filterLanguage === ‘otrosidiomas’){
wixLocation.to("/OtrosIdiomas");
}}
);
}