I am making some sliders with jquery-ui and i have a question how i can do the follow:
I have this html code:
<div class="slider range-slide">
<b>A range slider:</b>
<span class="amount"></span>
<div class="slide"></div>
</div>
And this is the js:
$(".range-slide").each(function () {
var $this = $(this);
$(".slide", $this).slider({
values: [30, 60],
min: 0,
max: 100,
range: true,
slide: function (event, ui) {
$("span.amount", $this).html("" + ui.values[0] +
" - " + ui.values[1]);
}
});
$(".range-slide span.amount").html("" + $(".slide").slider("values", 0) +
" - " + $(".slide").slider("values", 1));
});
Everyting is working fine but how can i do someting like this:
<div class="slider range-slide">
<b>A range slider:</b>
<span class="amount"></span>
<div class="slide" value="30,60" max="100" min="10"></div>
</div>
untested ...
Change your slider to use those values.
UPDATED: Check out this fiddle
UPDATE 2 Use split to separate the values by commas and assign them to variables. Fiddle