views:

229

answers:

2

i have 3 div's

<div id="slider-range1" class="slider-range"></div>
<div id="slider-range2" class="slider-range"></div>
<div id="slider-range3" class="slider-range"></div>

i have added the slider to these div's using class reference

$(function() {
        $(".slider-range").slider({
            range: true,
            min: 0,
            max: 100,
            slide: function(event, ui) {

            }
        });
});

the ranges of each sliders are different. I want to add that dynamically

I tried

$("#slider-range1").slider('option','values',[1, 100]);

but it is not working :(

+1  A: 

$('#slider-range').slider('option', 'min', 1);

$('#slider-range').slider('option', 'max', 100);

Updated according to poster's comment on this answer:

Actually, your question contains an naswer :)

http://jqueryui.com/demos/slider/#option-range

$("#slider-range").slider({
    range: true,
    min: 0,
    max: 500,
    values: [75, 300],
});
Darmen
my question was to set the values of the slider, not the min and max limits...
viMaL
@viMaL look at updated answer
Darmen
I think my question confused you...i've edited my question..please check now...
viMaL
+3  A: 

have you tried:

$('selector').slider( 'values' , index , value ); // index would be the square in the slider

in your example you could:

$("#slider-range1").slider('values', 0, 50);
$("#slider-range1").slider('values', 1, 100);
Reigel
thanks, that worked :)
viMaL
you're welcome.
Reigel