3

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 :(

0

2 Answers 2

5

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);
Sign up to request clarification or add additional context in comments.

1 Comment

Uncaught Error: no such method 'values' for slider widget instance, this error i am getting when trying the above solution ! @Reigel
1

$('#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],
});

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.