Reputation: 1520
I am trying to implement a slider but fore reason only an input field is displayed.
https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js
I have added:
bootstrap-slider.js
bootstrap-slider.css
What else besides an small piece of JS
<script type="text/javascript">
$('#ex1').slider({
formatter: function(value) {
return 'Current value: ' + value;
}
});
</script>
And the code itself?
<input id="ex1" data-slider-id="ex1Slider" type="text" data-slider-min="0" data-slider-max="20" data-slider-step="1" data-slider-value="14"/>
Please advice?
Upvotes: 0
Views: 641
Reputation: 406
You will need to include jQuery, add this before you include bootstrap-slider.js
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
You will also need to wait for jQuery before you initilize your slider
<script type="text/javascript">
$(document).ready(function() {
$('#ex1').slider({
formatter: function(value) {
return 'Current value: ' + value;
}
});
});
</script>
Upvotes: 3