How to get the value of the slider bootstrap?
I think it's currently broken.
Documentation states:
Methods
.slider('getValue')
Get the value.
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()
fast fix:
$.fn.slider = function (option, val) { if (typeof option == 'string') { if (this.length) { var data = this.eq(0).data('slider'); if (data) return data[option](val); return null; } } return this.each(function () { var $this = $(this), data = $this.data('slider'), options = typeof option === 'object' && option; if (!data) { $this.data('slider', (data = new Slider(this, $.extend({}, $.fn.slider.defaults, options)))); } })};
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.
$('input[id="sliderDivId"]').slider('getValue')