N
N
nikmil2019-06-30 15:18:11
css
nikmil, 2019-06-30 15:18:11

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

1 answer(s)
V
Vladimir Proskurin, 2019-06-30
@nikmil

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");
  });

but it's rather strange that you use the jQuery library with angular, although you could do it on Angular

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question