Skip to content
Advertisement

Multiple sliders reacting to each other

Newbie here. I am making one of my first project and I want to have sliders for different people in it (normal people, workers, farmers etc.) but I don´t know how to put multiple sliders and how to get all of them working. I took the code from W3schools and changed some things but it seems that I have broken it and I don´t know what to do with it. I want to have 2 sliders both working and when one slider goes up and the other goes down (assigning people to thier work). Here is my code (I don´t know if it would be to any help)

JavaScript
JavaScript
JavaScript

Advertisement

Answer

You can use DOMContentLoaded and addEventListener in order to start your task when the dom is ready.

After you querySelectorAll in order to select all your range elements and for each one its required an event handler.

Inside this event handler you can update the value.

Note: P + DIV now is P with a SPAN inside.

JavaScript
JavaScript
JavaScript
User contributions licensed under: CC BY-SA
9 People found this is helpful
Advertisement