Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to get values min and max from jQueryUI Slider

I am using the following code and I am wondering how to get the min and max values from the slider to my lowCount and HighCount variables? Right now it only returns NaN.

function countDown() {
$("#slider-range").slider({
      range: true,
      min: 0,
      max: 60,
      values: [5, 15],
      slide: function(event, ui) {
          $("#amount").val(ui.values[0] + " Minutes - " + ui.values[1] + " Minutes");
      }
  });


    $("#amount").val($("#slider-range").slider("values", 0) + " Minutes - " + $("#slider-range").slider("values", 1) + " Minutes");

    var lowCount = 60 * $("#slider-range").slider("values", 0);
    var highCount = 60 * $("#slider-range").slider("values", 1);
    return Math.floor(Math.random() * highCount) + lowCount;
}
like image 781
bammab Avatar asked Feb 23 '12 06:02

bammab


1 Answers

For min value

var min = $("#slider-range").slider("option", "min");

For low value

var low = $("#slider-range").slider("values")[0];
like image 172
arahant Avatar answered Sep 28 '22 07:09

arahant