Anand Anand - 4 months ago 25
Javascript Question

How to get selected value of double number range picker

How i can get the value of selected minimum and maximum range value

html

<div class="wrapper" style="width: 400px; margin: 100px auto; padding: 40px;">
<div id="double_number_range" style="margin-top: 50px;"></div>
<input type="submit">
</div>


js

(function() {
"use strict";
$("#double_number_range").rangepicker({
type: "double",
startValue: 0,
endValue: 100,
translateSelectLabel: function(currentPosition, totalPosition) {
return parseInt(100 * (currentPosition / totalPosition));
}
});
}());


fiddle

Answer

Probably there will be better solutions using for example a callback function but you can use the following code too:

$("input[type=submit]").on('click', function() {
  var minValue = parseInt($('span.label.select-label:eq(1)').text(), 10);
  var maxValue = parseInt($('span.label.select-label:eq(0)').text(), 10);
  console.log(minValue, maxValue);
});

jsfiddle