Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

bootstrap-slider change max value

I am currently using the Twitter bootstrap-slider library, and have been trying to figure out how to change the max value after the slider has been initialized. This question on how to retrieve the value was of some help, but I still cannot find the exact method to call. Here's what I have been trying so far:

JS:

$('#slider').slider({
    max: 100
});
$('#slider').slider({
    max: 200
});
console.log($('#slider').data('slider').max)

Console:

100

Setting the $('#slider').data('slider').max value directly also does not change the range of the slider itself, even thought the value has changed. Any help on setting the max value or re-initializing the slider would be much appreciated!!

like image 747
Wei Hao Avatar asked Jun 27 '13 05:06

Wei Hao


1 Answers

$slider = $('#slider');

// Apply max to redraw slider
$slider.slider({ max: value });
like image 115
Ravi Shankar Avatar answered Oct 25 '22 07:10

Ravi Shankar