javascript - How do i get current value from bootstrap slider? -
this related question asked in link how min , max value of bootstrap slider?
i not able answer particular question in discussion, thats why planed ask new question.
what need current min , max value bootstrap slider control in javascript.
this how control looks like
<input id="rbslider" type="text" class="span2" value="" data-slider-min="0" data-slider-max="1000" data-slider-step="5" data-slider-value="[0,1000]" />
and in button click tried min ans max value using following
var min = $('#rbslider').data('slider-min'); var max = $('#rbslider').data('slider-max');
but returns min 0 , max 1000 set min 2 , max 10.
how 2 , 10 in javascript?
for sure can way:
var min = $('#rbslider').data('slider').options.min; var max = $('#rbslider').data('slider').options.max;
update
probably need:
var min = $('#crslider').data('slider').options.value[0]; var max = $('#crslider').data('slider').options.value[1];
in general if want access widget data created using widget factory (https://learn.jquery.com/jquery-ui/widget-factory/how-to-use-the-widget-factory/) can using pattern:
var widget = $(selector).data(widget_name);
so if initialize widget example:
$('#ex1').datepicker();
you can access widget data by:
var datepicker = $('#ex1').data('datepicker');
and widget params in 'options' property.
use firebug or other web dev tool , play see can access , how.
regards piotr
Comments
Post a Comment