I'm trying to change the starting date of a bootstrap datepicker input field.
I have 2 fields both are datepickers.
- actie_begin
- actie_end
When I change actie_begin I want the startDate of actie_end to be set to the value of actie_start.
here's the code I wrote
<script type="text/javascript">
$(".actie_begin").datetimepicker({
format: 'yyyy-mm-dd',
startView: 'month',
minView: 'month',
autoclose: true,
startDate:'-0d'
});
$("#actie_end").datetimepicker({
format: 'yyyy-mm-dd',
startView: 'month',
minView: 'month',
autoclose: true,
startDate: '-0d'
});
$( ".datepicker" ).on('changeDate', function (ev) {
$('#actie_end').datepicker('setStartDate', $("#actie_begin").val());
});
</script>
The datepickers work, but when I try change the date on actie_begin I receive this error:
Uncaught TypeError: Cannot read property 'apply' of undefined
The values get set and I can pick the dates, but the startDate on actie_end does not work.
How can I solve this issue?
Aucun commentaire:
Enregistrer un commentaire