我如何阅读minValue&包括maxValue
<link rel="stylesheet" href="<?=base_url()?>javascripts/slider/jquery.ui.all.css">
<script src="<?=base_url()?>javascripts/slider/jquery-1.7.1.js"></script>
<script src="<?=base_url()?>javascripts/slider/jquery.ui.widget.js"></script>
<script src="<?=base_url()?>javascripts/slider/jquery.ui.mouse.js"></script>
<script src="<?=base_url()?>javascripts/slider/jquery.ui.slider.js"></script>
<form name="formList" id="formList" method="POST" action="<?php echo site_url();?>/hotels/search" enctype="multipart/form-data">
<script>
$(function () {
$("#slider-range").slider({
range: true,
min: 0,
max: 1000,
values: [100, 1000],
slide: function (event, ui) {
$("#amount").val("$" + ui.values[0] + " - $" + ui.values[1]);
}
});
$("#amount").val("$" + $("#slider-range").slider("values", 0) +
" - $" + $("#slider-range").slider("values", 1));
$("#minValue").val(ui.values[0]);
$("#maxValue").val(ui.values[1]);
});
</script>
<div class="left" id="leftSlider">
<label for="amount">Price range:</label>
<input type="text" id="amount" style="border:0; color:#f6931f; font-weight:bold;" />
<!-- <div id="range">Price Range <span id="amount"></span></div>
<div id="slider"></div>-->
<div id="slider-range"></div>
答案 0 :(得分:0)
您希望您的逻辑位于幻灯片的功能中:
$(function() {
$( "#slider-range" ).slider({
range: true,
min: 0,
max: 1000,
values: [ 100, 1000 ],
slide: function( event, ui ) {
$( "#amount" ).val( "$" + ui.values[ 0 ] + " - $" + ui.values[ 1 ] );
$( "#amount" ).val( "$" + $( "#slider-range" ).slider( "values", 0 ) +
" - $" + $( "#slider-range" ).slider( "values", 1 ) );
$( "#minValue" ).val( ui.values[ 0 ] );
$( "#maxValue" ).val( ui.values[ 1 ] );
}
});
});