Implement toggle Switch with function

Hi there, I’ve been now trying for a while to solve this issue myself but I can’t get behind how and even if I can make it work. A friend referred me to this forum, so I thought it won’t hurt to ask.

My Project: SoulWorker Skill Simulator
The website I’m working on is a Skill Simulator for the game “Soulworker” and recently came an update out that increased the SP(Skill Points) in the game to an amount, that no other version has - 1 server has 181SP and the rest all have 173SP at Max level (76).
The Skillsim was always universal for all version/servers of the game, so I came up with the plan to implement a Toggle Switch when switched, it switches to the amount of SP for what Server the user needs.

For the basic toggle switch, I implemented: Bootstrap 4 Toggle Switch Button Checkbox
and got that working visually how I wanted.
After that, I tested if the switch gives out a signal - true/false, and it does.

I then proceeded to implement the 2 different SP tables for each case:
if “Global Server” then “181 SP”
if “Other Server” then “173 SP”

but this only works if I manually check/uncheck the switch inside the code and not on the page itself.
The next issue is that I wasn’t able to implement that the toggle switch is listed in the URL parameters, so that people can copy their skill builds. (ex: …index.html?glb=true&…)
I don’t know if this has to do with that it gives out: true/false.

I’ve tried making an EventListener on change, because the “chance” function worked on the console.log as well (see image above) but that also got me nowhere. But nothing worked so far and I’m honestly clueless.
If anyone wants to contact me, I am mostly on Discord: “Eden~♡#2724”, but I’ll obviously look in here.
I appreciate every help I can get at this point.

Edit: all this code about the toggle switch is not uploaded on github, I just have it local as of right now. But the base code for the website is in the gitrepo.

Hey @Eden333, welcome to the forum.

Unfortunately your request is too vague and generic to actually provide meaningful help, especially since you didn’t provide any code snippets whatsoever.

In general to maximise your chances of getting help it’s best to either have a reproducible demo, or to provide a small, relevant, section of your code that you believe it’s causing trouble.

For example when you say

It’s really impossible to help if we don’t know what you have tried and how’s your code.

Perhaps get back to the forum with some better info, and I am sure someone will be able to help. :slight_smile:

It’s oke, I already got help, thx

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.