Question: I am currently using the Twitter [bootstrap-slider](http://www.eyecon.ro/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](https://stackoverflow.com/questions/15736694/how-to-get-the-value-of-the-slider-bootstrap) 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!!

Answer: 
I struggled getting this to work with various examples and eventually sorted it with this syntax, which I added into my function where needed. 

```
strMin=3;
strMax=5;

$("#myslider").data('slider').min=strMin;

$("#myslider").data('slider').max=strMax;

$("#myslider").data('slider').value="[" + strMin + "," + strMax + "]";

$("#myslider").data('slider').setValue([strMin,strMax],true);

```
The best you can do is set the min and max and re-apply the value. You can do this in a few ways. But what I did was to create a setMax and setMin extension method that sets the min and max. The only problem with this was I needed to change the plugin to extend $this instead of this, because my setMin and setMax extension methods wasn't available.

So change this...

```
$this.data('slider', (data = new Slider(this, $.extend({}, $.fn.slider.defaults,options))));

```

...to this...

```
$this.data('slider', (data = new Slider($this, $.extend({}, $.fn.slider.defaults,options))));

```

...in the library. If you want to add on your own extension methods. But then you still have to do setValue either in the library in your extension method or outside. (setValue does the calculation for the position of the slider handles and the layout of the slider)

So you can do something like this...

```
$('#sldOne').on('slideStop', function (ev) {
                $('#sldTwo').slider('setMin', 0);
                $('#sldTwo').slider('setMax', 4);
                $('#sldTwo').slider('setValue', new Number($('#sldTwo').val()));
            });

```

i.e. On the first slider's slideStop event set the min and max of the second slider. And then call setValue again to re-do the layout.