我想从开始到结束值收集jQuery UI Slider的值,并在输入文本框中显示。
jQuery代码:
$(function () {
$("#Slider1").slider({
from: 1000,
to: 100000,
step: 500,smooth: true, round: 0, dimension: " RS ", skin: "plastic",
slide: function (event, ui) {
//$("#lblPrice").text("Price range: Rs " + ui.values[0] + " - " + ui.values[1]);
var val = $('#Slider1').slider("option", "value");
alert(val);
$("#PrcRange").val("Price range: Rs " + ui.values[0] + " - " + ui.values[1]);
alert($("#minval").val(ui.values[0]));
$("#minval").val(ui.values[0]);
$("#maxval").val(ui.values[1]);
}
});
$("#PrcRange").val("Rs " + $("#Slider1").slider("values", 0) + " - Rs" + $("#Slider1").slider("values", 1));
});
和html:
<div class="layout-slider" style="width: 100%">
Slider <span style="display: inline-block; width: 400px; padding: 0 5px;"><input id="Slider1" type="slider" name="price" value="30000.5;60000" /></span> in Amount
<div id="slider-range"></div>
<input id="minval" type="text" />
<input id="maxval" type="text" />
<input id="PrcRange" type="text" />
</div>