jquery - Troubles getting value from bootstrap-slider -
i using bootstrap slider
forecasting tool building. have following function:
function updatecontractconcern () { showloader(); var funcid = "call_chart_contract_concern" var forecastperiod = $('#forecastslider').data('slider').getvalue(); //var forecastperiod = 4; console.log('forecastperiod') var jqxhr = $.getjson('functions/getfunctions.php', { "forecastperiod":forecastperiod, "funcid":funcid}).done(function(datachart) { hideloader(); if (datachart == null) { bootbox.alert("er geen data voor deze selectie aanwezig"); } else { setbasicpropertiesaveragescorechart(); averagescorechart.dataprovider = datachart; averagescorechart.categoryfield = "organisatie"; averagescorechart.validatedata(); } }) .fail(function() { hideloader(); bootbox.alert("er kon geen data verkregen worden uit de database"); }); //when getjson request fails }
the problem having here var forecastperiod = $('#forecastslider').data('slider').getvalue();
not give me value of slider. thoughts on this?
the html
code follow:
<div class=text-center> <label id="labelforecastslider"><i class="fa fa-clock-o" id="iconclock"></i> bepaal de forecast periode:</label> <!-- range --> <input id="forecastslider" data-slider-id='forecastslider' type="text" data-slider-min="1" data-slider-max="12" data-slider-step="1" data-slider-value="0"/> </div>
the javascript
goes slider is:
var slider = new slider("#forecastslider", { focus: true, formatter: function(value) { var months = ['t/m januari', 't/m februari', 't/m maart', 't/m april', 't/m mei', 't/m juni', 't/m juli', 't/m augustus', 't/m september', 't/m oktober', 't/m november', 't/m december']; return months[value - 1]; } });
when use var forecastperiod = $('#forecastslider').val();
, nothing happens, when set variable "hard" number this: var forecastperiod = 2;
code work.
since bootstrap-slider can seen input field, want use following code:
var forecastperiod = $('#forecastslider').val();
hope helps you!
Comments
Post a Comment