I'm using the Jquery slider.
<script>
$(function() {
$( "#slider-range-max" ).slider({
range: "max",
min: <%=minprice%>,
max: <%=maxprice%>,
value: <%=minprice%>,
slide: function( event, ui ) {
$( "#amount" ).val( ui.value );
}
});
$( "#amount" ).val( $( "#slider-range-max" ).slider( "value" ) );
});
</script>
<div class="demo">
<label 开发者_开发问答for="amount">Selecteer uw maximum prijs: €</label>
<input type="text" id="amount" name="maxprijs" style="border:0; color:#f6931f; font-size:14px; font-weight:bold;" />
<div id="slider-range-max"></div>
</div>
How can I get the value/result of the slider so I can use that value in my ASP script?
something like this:
console.log($("#slider-range-max").slider('value'));
More info:
http://docs.jquery.com/UI/Slider#method-value
From there you could easily set that value to a hidden input field:
<input type="hidden" name="slider_val" id="slider_val" />
<script>
var val = $('#slider-range-max').slider('value');
$('#slider_val').val(val);
</script>
I've got this right now:
<script>
$(function() {
$( "#slider-range-max" ).slider({
range: "max",
min: <%=minprice%>,
max: <%=maxprice%>,
value: <%=minprice%>,
slide: function( event, ui ) {
$( "#amount" ).val( ui.value );
}
});
$( "#amount" ).val( $( "#slider-range-max" ).slider( "value" ) );
});
</script>
<div class="demo">
<label for="amount">Selecteer uw maximum prijs: €</label>
<input type="text" id="amount" name="maxprijs" style="border:0; color:#f6931f; font-size:14px; font-weight:bold;" />
<div id="slider-range-max"></div>
</div>
<script>
var val = $('#slider-range-max').slider('value');
$('#slider_val').val(val);
</script>
<form name="priceSearch" method="post" action="sanitair.asp">
<input type="hidden" name="act" value="price" />
<input type="hidden" name="slider_val" id="slider_val" />
<input type="button" class="infoButton" value="Sorteren" onclick="searchpr()" />
But slider_val is empty, what's going wrong?
精彩评论