How do I modify the min and max value of a jQueryMobile slider at runtime?

120 Views Asked by At

So I have a slider in my HTML document:

<input type="range" name="testSlider" id="testSlider" min="0" max="100" value="0" />

I want to modify the min and max range at run time, but I can't find any documentation on how to do this.

I apologize if this is obvious, but I'm really struggling with this seemingly obvious task. Thanks!

1

There are 1 best solutions below

0
On BEST ANSWER

You can use jQuery's .attr() method.

$('#testSlider').attr('min',MINVALUE);
$('#testSlider').attr('max',MAXVALUE);

And then you refresh the slider

$('#testSlider').slider( "refresh" );

OR

$("#testSlider").slider( "option", { min: MINVALUE, max: MAXVALUE} );