[Answered ]-Slider for bootstrap with multiple sliders

2👍

Update 2

First of all, you’ll need to make sure that the value of data-for of an input and the id of the span associated with it are same. Because that is how you will know which span to change.

So, change the span like this:

<span id="slider_value_{{ field.pk }}">3</span>

Note: If, however, you don’t want to change the span‘s id, you can change the value of data-for to slider_value_{{ filter.pk }}. Just remember, both should match.

Now the JavaScript/jQuery part

$('[id^=slider-]').slider();

$('[id^=slider-]').on("slide", function(slideEvt) {
    changer_span = $(this).attr('data-for');
    $('#' + changer_span).text(slideEvt.value);
});
👤xyres

Leave a comment