You can use the for loop to create a slider with each element. You can add a slider instance to the array and use it later.
var options = { precision: 2, value: 5 }; var slider = []; for (var i = 1; i <= 13; i++) { slider.push(new Slider("#survey" + i, options)); }
If the plugin supports multiple selectors
var slider = new Slider("#survey1, #survey2, #survey3 ...", { precision: 2, value: 5 });
Another way is to assign a common class to all elements and use this class to assign a slider. As stated above, it depends on the definition of Slider .
var slider = new Slider(".slider", { precision: 2, value: 5 });
source share