How can I redirect to a website on new tab from links setup to a dropdown menu

import wixLocation from ‘wix-location’ ;

$w . onReady ( function () {

$w ( "#dropdown1" ). options  = [ 
 { "label" :  "Youtube Channel" ,  "value" :  "https://www.youtube.com/channel/UCUrnVejb4n7gaIfr1--GyOg" }, 
 { "label" :  "Gaming Profile" ,  "value" :  "https://itlearnhow.com/gamingwitharcbs" }, 
 { "label" :  "Minecraft (Hypixel)" ,  "value" :  "https://sky.shiiyu.moe/stats/Arcbs/Peach" }, 
 { "label" :  "Github" ,  "value" : "https://github.com/Arcbs" }, 
 { "label" :  "Fiverr" ,  "value" : "https://www.fiverr.com/arcbs5?up_rollout=true" } 

];

});

export function dropdown1_change ( event ) {
let gotourl = $w ( “#dropdown1” ). value ;
wixLocation . to ( gotourl );
}

so this is the code I used for a dropdown menu which redirects to urls from clicking on a dropdown menu but they open on the same tab in which my website rather than in a new tab

but i want to redirect the urls to a new tab, any way to fix that please tell me D:

I think → you won’t be able to do your wished redirection directly from dropdown. Instead add an additional button, which will appear and loaded with the right URL. Now you would be able to open your loaded link of the button in a new TAB…

https://www.wix.com/velo/reference/$w/button/link

Game-developer?

no i am not a game developer, but still i cant understand that how can i use the specific value of a dropdown to redirect to a url on a new page

Check it out here. https://www.wix.com/velo/reference/$w/button/target

@thisisarcbs as Ninja said, it can’t be done using wixLocation.to.
Only with a button or a text link (as you can’t link a drop-down option in Wix).

Solutions (each of the followings):

  1. Create a dropdown in an iframe (aka site widget) (see code below).

  2. Create a dropdown in a custom element.

  3. Instead of using a real dropdown, put a box with the options as buttons , design it as if it was a dropdown, and set the target to be _blank.
    Code for iframe:

<!doctype html>
<html>
<body>
  <select name="myoptions" id="myoptions" onChange="window.open(this.value, '_blank')">
    <option value="https://www.youtube.com/channel/UCUrnVejb4n7gaIfr1--GyOg">Youtube Channel</option>
  <option value="https://itlearnhow.com/gamingwitharcbs">Gaming Profile</option>
</select>
 </body>
</html>

See also: