[SOLVED] Dropdown list not redirecting to desired URLs

So, basically, I created a dropdown list on my site to rapidly switch from a page to the other. Since it is a webcomic series, there are many chapters to read and, if one wants to go from, say, chapter 1 to chapter 4, they’d just have to click on the dropdown list and select the chapter they want to read. I used the following code for it:

import wixLocation from 'wix-location';
$w.onReady(function () {
   $w("#dropdown1").options = [
  {"label": "Chapter 1- Birth of a legend", "value": "https://doublecomics.wixsite.com/ageofdarkness/chapter-1"},
  {"label": "Chapter 2- Life at the orphanage", "value": "https://doublecomics.wixsite.com/ageofdarkness/chapter-2"},
  {"label": "Chapter 3- Awakening", "value": "https://doublecomics.wixsite.com/ageofdarkness/chapter-3"},
];

});

export function dropdown1_change(event) {
 let gotoUrl = $w("#dropdown1").value;
wixLocation.to (gotoUrl);

My problem is that, the first time I used it, it worked perfectly. Then, I proceeded to copy and paste the dropdown list to the other pages, and when I went back and tried again, it no longer worked! Thinking the copy-pasting was a mistake, I decided to delete the dropdown lists from the other pages and just leave it in the first one, but it still didn’t work.

Is there a way to fix this and make it work again? I really need to redirect the user from a page to the other. Here’s a link to my website: https://doublecomics.wixsite.com/ageofdarkness

And here’s the page in question: https://doublecomics.wixsite.com/ageofdarkness/chapter-1

Thanks in advance!

I tried it on your site and it worked as expected.

Hi there! Yeah, I reused the code after a while and it seems to be working now. The one I posted is the right one, but the one I had used on my site was missing the

exportfunctiondropdown1_change(event){

part and it was also missing the brace right below the semi-colon. I’m not an expert of coding so I easily mess up things :sweat_smile: