Reputation: 857
I am using ionRangeslider in one of my forms to show the range of tips.
How can I update the value on submit button click so that when next time page loads, it shows the slider with that particular updated value?
HTML code
<input type="text" class="exampleslider" id="exampleslider" name="tips">
And Calling to ionRangeSlider via js
$('.exampleslider').ionRangeSlider({
from: 0,
to: 100,
min: 0,
grid: true,
grid_num: 10,
step: 10,
postfix: '%',
});
Input is given name tips through which I want to set its value via database.
Upvotes: 11
Views: 12779
Reputation: 6067
I have a slider with custom values.
In this case, the indices should be used as from
to
values instead of actual values.
For example, the slider was initialized with this array:
[0, 100, 500, 1000, 2000, 10000]
Let update its handles to be on 500
and 2000
:
var data = $('#' + id).data("ionRangeSlider");
data.update({
from: 2,
to: 4
});
Upvotes: 1
Reputation: 351
var instance = $(id).data("ionRangeSlider");
instance.update({
from: 10 //your new value
});
Upvotes: 20