How to get the values of the slider bootstrap to hidden iputs?
<input type="hidden" name="min_value" id="min_value" value="">
<input type="hidden" name="max_value" id="max_value" value="">
$(function() {
$( "#slider-range-s1" ).slider({
range: true,
min: 0,
max: 500,
value: [ 0, 500 ]
});
});
The problem is, that there is more than 1 element with the same ID (the slider div and the input inside the slider div), in this example $('#sliderDivId'). If you select the input element with JQuery, you can use the slider API.
I know I'm late but this is still broken but to fix it open up
bootstrap-sliders.js
and inject these three things:the very end of the first function:
Slider
:right before:
return val;
in thecalculateValue
functionafter the
$.fn.slider
function:Now you can access the value by
$('#MySliderId').sliderValue()
At time of writing it's a bit flaky but you can make it work:
1/ Make sure you specify an empty range starting "value[0]". Unless you do this its internal value field becomes undefined e.g.
2/ Now finally you can catch the value in the event
fast fix:
you can use this from the built in function
and thank you i thought i coud share this with you guys :D
I think it's currently broken.
Documentation states:
How ever, calling
$('#sliderDivId').slider('getValue')
returns the jQuery selector rather than the value...For now you could manually grab it from the data object...
$('#sliderDivId').data('slider').getValue()