in my webapp I'm using bootstrap components; in one of my pages I'm trying to put a bootstrap datepicker, or better a datetimepicker, still with no luck.
My css and js imports are (in order):
- bootstrap.css
- datepicker.css
- jquery.js
- bootstrap.js
- bootstrap-datepicker.js
The code I'm writing is:
<div class="container">
<div class="row">
<div class='col-sm-6'>
<div class="form-group">
<div class='input-group date'>
<input data-format="dd/MM/yyyy hh:mm:ss" type='text' class="form-control" id='datetimepicker2' />
<span class="input-group-addon"><span class="glyphicon glyphicon-calendar"></span>
</span>
</div>
</div>
</div>
<script type="text/javascript">
$(document).ready(function() {
$('#datetimepicker2').datetimepicker();
});
</script>
</div>
</div>
But i tried lot of combinations of the script (avoiding the document ready function call and just calling the function), setting the 'datetimepicker2' id both on div and input, always with no luck.
When I try my datepicker nothing happens, and in the console I always get the:
uncaught typeerror undefined is not a function
error on the line:
$('#datetimepicker2').datetimepicker();
I have searched along the web and I'm not the only one having this problem, lot of people solved putting in the div class the 'date', but that didn't do the trick for me. Other people suggested to import jQueryUI too, but still no luck. Any hint?
bootstrap-datepicker.jsand tried to usedatetimepicker. Is that it?