I may lack basic knowledge of retrieving data in Javascript. So I am reading the value of range slider using a jquery plugin called noUiSlider. Here is there basic code:
html:
<div id="slider"></div>
<div id="value-input-left" style="font-size:12px"></div>
<div id="value-input-right" style="font-size:12px"></div>
jQuery:
<script>
$(document).ready(function(){
$("#slider").noUiSlider({
start: [20, 80],
connect: true,
range: {
'min': 0,
'max': 100
}
});
$('#slider').Link('lower').to($('#value-input-left'));
$('#slider').Link('upper').to($('#value-input-right'));
alert("return value of range slider" +$("#slider").val());
});
</script>
The $("#slider").val() returns array[value, value], in this example it's 20.00, 80.00. But what is the easiest way to get their value separately?
For instance, I've tried:$("#slider").val(0); $("#slider").val[0] , $("#slider").lower() and $("#slider").get(0) but none of them works.
The documentation of this plugin is http://ift.tt/1zIPlsa
Thanks!
Aucun commentaire:
Enregistrer un commentaire