This tutorial aims to show you how to redirect a user with dropdowns.
Required Elements: 1x Dropdown Element
APIs Used:
Wix Location
Specific Requirements
Add a https:// or http:// URL to the value of the dropdown, e.g. https://heathh-m.wixsite.com/wix-code-extracts/home. Add some meaningful text to the label of the dropdown, e.g. Homepage.
Do this for as many URLs as you want.
The Code:
import wixLocation from 'wix-location';
$w.onReady(function () {
$w("#redirectDropdown").onChange((event) => {
let URLparam = $w('#redirectDropdown').value;
wixLocation.to(URLparam);
});
});
Editable Features
Any URL you want to add!