Quantcast
Channel: Active questions tagged javascript - Stack Overflow
Viewing all articles
Browse latest Browse all 142382

Drop down menu directing to same URL

$
0
0

I have created a drop down menu with multiple options to chose from. However what ever option I chose it directs me to the same URL. In this case the last written code. Could someone please tell me what I have missed in the code?

import wixLocation from 'wix-location';

$w.onReady(function () {
    $w("#dropdown1").onChange((event, $w) => {
        console.log(event.target.value); //iPhone X
        wixLocation.to("/iphonex");
    });
});
$w.onReady(function () {
    $w("#dropdown1").onChange((event, $w) => {
        console.log(event.target.value); //iPhone XS
        wixLocation.to("/iphonexs");
    });
});
$w.onReady(function () {
    $w("#dropdown1").onChange((event, $w) => {
        console.log(event.target.value); //iPhone XS MAX
        wixLocation.to("/iphonexsmax");
    });
});

Viewing all articles
Browse latest Browse all 142382

Trending Articles