Hello,
I have multiple sliders on my page and I want to be able to have the total value of the sliders automatically calculated (e.g., if some enters 5, 7, and 10 for three sliders, have it automatically calculate in a separate column the total of 22). Is there a way to do this?
Thank you!
Do you enter your VALUES into an INPUT-FIELD?
$w.onReady(()=>{});
$w('#myButtonIDhere').onClick(()=>{
let value1 = $w('myInputField1Idhere').value; console.log(value1)
let value2 = $w('myInputField2Idhere').value; console.log(value2)
let value3 = $w('myInputField3Idhere').value; console.log(value3)
let sumResult = value1+value2+value3; console.log(sumResult);
});
});
This is a very simple example which should show you the right way…
This example expects the following elements…
3x Input-Fields
1x Button
You can take a look onto the results in the CONSOLE.
Just not to forget again → You will have to convert the results of all inputs to NUMBERS, do not forget this.
let myNumber = Number(myString);
Yes, I used the input tools so that when someone goes on the site they can input their values for the sliders. I’d like to have a fourth row that will sum up the 3 values they entered.
Hey thanks so much for the help! How do I display the sum result on the website?
Thank you again!