How to get values from JQuery - IonRangeSlider?

// Launch plugin
$("#range").ionRangeSlider({
    type: "double",
    min: 0,
    max: 1000,
    from: 200,
    to: 500
});

// Saving it's instance to var
var slider = $("#range").data("ionRangeSlider");

// Get values
var from = slider.result.from;
var to = slider.result.to;

See solution at http://jsfiddle.net/2qLum6s7/. Works with latest version of Ion.RangeSlider (2.1.2).


Use jQuery's data() method:

var low = $('#range_1').data().from;
var high = $('#range_1').data().to;

here is a solution: http://jsfiddle.net/IonDen/xaaw56bk/

var $range = $(".js-range-slider"),
    $result = $(".js-result"),
    $getvalues = $(".js-get-values"),

    from = 0,
    to = 0;

var saveResult = function (data) {
    from = data.fromNumber;
    to = data.toNumber;
};

var writeResult = function () {
    var result = "from: " + from + ", to: " + to;
    $result.html(result);
};

$range.ionRangeSlider({
    type: "double",
    min: 10,
    max: 50,
    from: from,
    to: to,
    onLoad: function (data) {
        saveResult(data);
        writeResult();
    },
    onChange: saveResult,
    onFinish: saveResult
});

$getvalues.on("click", writeResult);

Previous answer was based on old plugin API and don't work any more. Here is the new one, for 2.x version: http://jsfiddle.net/IonDen/2L15xoym/

var $range = $(".js-range-slider"),
    $result = $(".js-result"),
    $getvalues = $(".js-get-values"),

    from = 0,
    to = 0;

var saveResult = function (data) {
    from = data.from;
    to = data.to;
};

var writeResult = function () {
    var result = "from: " + from + ", to: " + to;
    $result.html(result);
};

$range.ionRangeSlider({
    type: "double",
    min: 10,
    max: 50,
    from: from,
    to: to,
    onStart: function (data) {
        saveResult(data);
        writeResult();
    },
    onChange: saveResult,
    onFinish: saveResult
});

$getvalues.on("click", writeResult);