I need a jquery slider with two handles with inputs from two textbox like this http://www.israel-diamonds.com/search/diamonds/default.aspx .Currently i have a single handle slider with input from a single textbox
$("#slider").slider({
value: 1,
step: 1000,
min: 0,
max: 5000000,
slide: function(event, ui) {
$("input").val("$" + ui.value);
}
});
$("input").change(function () {
var value = this.value.substring(1);
console.log(value);
$("#slider").slider("value", parseInt(value));
});
Any suggestion?
EDIT:
<div class="demo">
<input type="text" class="sliderValue" />
<p>
</p>
<div id="slider"></div>
</div>
and
$("#slider").slider({
range: "min",
value: 1,
step: 10,
min: 0,
max: 1000,
slide: function (event, ui) {
$("input").val(ui.value);
}
});
$("input").change(function (event) {
var value1 = parseFloat($("input").val());
var highVal = value1 * 2;
$("#slider").slider("option", { "max": highVal, "value": value1 });
});
From the official jQuery UI Documentation: https://jqueryui.com/slider/#range
Assuming you have two
<input>
elements:And a slider placeholder element:
You can use the
values
option to put the slider widget in multiple handle mode, and synchronize the values of the<input>
elements with:You can see the results in this fiddle.