I’ve been trying to create a button on my website that takes you to a random page out of an array of URLs. I don’t have a lot of programming knowledge but I’m motivated to pull this off.
So I’ve found this piece of code on the forum. But it doesn’t seem to work for me.
My button is also named button1
I’m saving the code in the page section of the coding area in the WIX editor. Is that right? Is the code not “connected” to the button yet?
The good news is your code works just fine. I tried your exact code on a test page and it works.
The bad news is that I don’t know why it’s not working for you. Perhaps you have your button connected to an onClick() event handler? That would create a conflict with the link.
Hello, I’ve tried to place the above code into my site, but it only wants to repeatedly select one of the url’s even though I have multiple urls placed in the “const allUrls” section.
Any additional ideas on how to solve this issue and have the code “recognize/consider” all the listed urls?