I am working with bootstrap datepicker in my application developed in laravel 5.6. It works fine, until I add the option of setStarDate and setEndDate when it starts to throw the error
Uncaught TypeError: $(...).datepicker is not a function
Datepicker libraries are added in the master template in the
section@yield('adminlte_css')
<!-- datepicker -->
<link href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.6/css/bootstrap.min.css" rel="stylesheet">
<link href="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/css/bootstrap-datepicker.css" rel="stylesheet">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/bootstrap-datepicker/1.5.0/js/bootstrap-datepicker.js"></script>
I tried adding them in another section (js) but it does not work for me.
The issue is what am I doing wrong, that does not work for me when I want to use those set options for dates
The calendar script code is before closing @section ('content')
<script type="text/javascript">
$('#datedesde').datepicker({
format: 'dd-mm-yyyy',
language: 'es',
autoclose: true,
todayHighlight: true,
}).on('changeDate',
function (selected) {
$('#datehasta').datepicker('setStartDate', $('#datedesde').val());
});
$('#datehasta').datepicker({
format: 'dd-mm-yyyy',
language: 'es',
autoclose: true,
todayHighlight: true,
}).on('changeDate',
function (selected) {
$('#datedesde').datepicker('setEndDate', $('#datehasta').val());
});
</script>
@stop