Change a Link | WixCreate | Wix Code - Corvid
 

Wix Tutorial - Change a Link, using Wix Code

This tutorial will show you how to change button links for different scenarios using Wix Code. You will be able to direct visitors to different webpages based on their user input.

Elements:

User Input:

  • Dropdown: #DropDown1  |  Pinned & Show on all pages

Elements:

  • More Information Button: #MoreInfo

External URLs:

  • Website 1 (insert URL 1)

  • Website 2 (insert URL 2)

Wix Code (on site tab):

import wixLocation from 'wix-location';
 
export function GoToWebsite_click(event, $w) {
 
        let option = $w("#dropdown1").value;

        if ( option === "website1" ) {
            wixLocation.to("URL1");
        } else {
             wixLocation.to("URL2");
    }
}

Demo:

arrow&v

Websites designed by WixCreate that use the above Wix Code:

None

Official Wix Expert & Wix Agency Partner

© 2020 by WIXCreate.com

I  All Rights Reserved  I  info@wixcreate.com  I  202-640-5440

facebook-2.gif