Need some help for JS

Hi there !

I have to finish making this project https://codepen.io/mindwarp77/details/JjboYBY but i am in front of a little problem.
I would like to change the price values when i switch my button, but i don’t really know how to do it, i’m a little lost.

If you have some ideas (i know you have), let me know please :wink:

Thanks a lot !

Bye !

you probably need a function to recalcuate the showed price, triggered when the slider is moved and also when the button is clicked, which uses bioth slider position and the toggle fo the button to calculate the price and print it to the page, here you have too much stuff nto connected, you need to have together both logics

  var slider = document.getElementById("myRange");
            var output = document.getElementById("valeur");
            var output2 = document.getElementById("valeur2");
            var output3 = document.getElementById("billing");
            output.innerHTML = slider.value;
            output2.innerHTML = slider.value;
            function yearBilling (){
                output.innerHTML = slider.value * 9;
            }
            slider.oninput = function (){
                output.innerHTML = this.value;
                output2.innerHTML = this.value * 6.25;
            }

Thanks for your answer, i’ll work on it :wink:

1 Like