0

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!

Benjamin
  • 13
  • 1
  • Did you try `$('#testSlider').attr('min',myNewMinValue);` and `$('#testSlider').attr('max',myNewMaxValue);` ? – orique Oct 28 '13 at 07:26
  • You can use jQuery Slider Widget's [option](http://api.jqueryui.com/slider/#method-option). Check the answer below. – Subedi Kishor Oct 28 '13 at 07:39

1 Answers1

0

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} );
Subedi Kishor
  • 5,906
  • 5
  • 35
  • 53