my Problem is, that my loop with a SetTimeout function does work but I need it to subtract one variable from another every 50ms but it only works once. Here is my code:
<label for="customRange1">Weighting <output id="amount1" name="amount1" for="rangeInput1">100</output>%</label>
<input type="range" id="customRange1" name="rangeInput1" class="custom-range" min="0" max="100" value="100"
oninput="this.form.amount1.value=this.value">
<p id="display"></p>
function input1(ev) {
function1();
var outputvalue1 = document.getElementById('amount1').value;
}
document.getElementById('customRange1').addEventListener('input', input1);
var weightingall = 100;
function function1(){
var weighting1 = outputvalue1;
var inputmax = weightingall - weighting1;
document.getElementById("display").innerHTML = test5;
setTimeout(function1, 50);
}
function1();