Opening external link using velo code

Question:
[Is is possible to open a link using velo (Wix Editor) code instead of manually clicking on a butto?.]

Product:
[Which editor or feature is your question most relevant to? Wix Editor.]

What are you trying to achieve:
[I want to go to an external link based on the option selected from a dropdown menu.]

What have you already tried:
[wixLocation.to(link); window.location.href = link;]

Additional information:
[.]

wixLocation.to(link); window.location.href = link;

That do not really look right.

First you will have to import wixLocation-API
import wixLocationFrontend from 'wix-location-frontend';

Then you can use wixLocationTo() inside of your onReady() function.

$w.onReady(()=>{
     wixLocation.to(url)
});

But first you have to define your url.
The definition of URL can be different → STATIC or DYNAMIC

STATIC-URL:
https://www.goole.com

DYNAMIC-URL:
BASE-URL+PREFIX + PATH

  1. baseUrl - Velo API Reference - Wix.com
  2. prefix - Velo API Reference - Wix.com
  3. path - Velo API Reference - Wix.com