I have several javascript sliders on a page and I want to be able to enable or disable each by using a variable.
For example, I have a slider:
var slider1 = new Slider('#sitSlider', {
formatter: function(value) {
return value;} });
and I enable/disable it with this:
slider1.disable();
I would like to be able to do something like this to turn off several switches:
for(x=0;x<20;x++){
var tmpStr = "slider"+x;
tmpStr.disable();
}
I did some searching and tried this without success:
this[tmpStr].disable();
How do I go about using a variable to call an object? Thanks.
Edit: Here's the slider component I'm using: Bootstrap Slider