Answer the question
In order to leave comments, you need to log in
How to make the numbers change synchronously with the value of the slider?
Good afternoon, as you can see in the code there is a slider with its value in% and when you drag the bar, the value immediately changes, rather than with numbers ( $ and L ).. How to make the numbers change immediately without releasing the slider button, just like changes value in %?, https://codepen.io/milnik/pen/ewVEOJ
Thanks in advance for your help!
Answer the question
In order to leave comments, you need to log in
We need to listen not onchange, but oninput
$('#inputslider').on('input', function () {
var v = $(this).val();
var dolar = $('#dollars');
var litr = $('#litters');
var input = v*3;
var output = v*1;
$('#dollars').html("$" + input);
$('#litters').html(output + "l");
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question