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…
@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):
Create a dropdown in an iframe (aka site widget) (see code below).
Create a dropdown in a custom element.
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: