javascript - How to get HTML5 Range (2 slides) Slider's value in PHP? -
i have code:
html:
<div class="unit"> <div class="slider-group"> budget: <label id="2-h"></label> </div> <div id="slider-2-h"></div> <input type="hidden" name="sliderbudget" id="slidervalue" value=""> </div>
javascript:
$(function() { $( '#slider-2-h' ).slider({ range: true, min: 0, max: 500, values: [ 75, 300 ], slide: function( event, ui ) { $( '#2-h' ).html( '€' + ui.values[ 0 ] + ' - €' + ui.values[ 1 ] ); }, change: function(event, ui) { $('#slidervalue').attr('value', ui.value); } }); $( '#2-h' ).html('€' + $('#slider-2-h' ).slider( 'values', 0 ) + ' - €' + $( '#slider-2-h' ).slider( 'values', 1 ) ); });
but have range - to, , 1 input (hidden). set secound input (hidden) can send secouund value input?
i set secound:
change: function(event, ui){ $('#slidervalue').attr('value', ui.value); }
with ui.value[1]
it's not ok
the simple way achieve goal having 2 input fields.
add input value different name.
<input type="hidden" name="sliderbudget2" id="slidervalue2" value="">
and alter change
event set new input value.
change: function(event, ui){ $('#slidervalue').attr('value', ui.value[0]); $('#slidervalue2').attr('value', ui.value[1]); }
Comments
Post a Comment