Bootstrap DatePicker - Onchange
Bootstrap 4
The eonasdan datepicker plugin is no longer supported in Bootstrap 4, but there is a new plugin: https://tempusdominus.github.io/bootstrap-4
"Tempus Dominus is the successor to the very popular Eonasdan/bootstrap-datetimepicker"
To detect the change event, use:
$("#datetimepicker1").on("change.datetimepicker", function (e) {
if (e.oldDate !== e.date) {
alert('You picked: ' + new Date(e.date).toLocaleDateString('en-US'))
}
})
Datepicker demo: https://codeply.com/p/kS0t1Ko61K
Bootstrap 3 (original answer)
According to the docs, the event is dp.change
:
$('#myDatePicker').datetimepicker().on('dp.change',function(e){
console.log(e)
})
http://www.codeply.com/go/5cBJkEHiAt
You can try this:
$("#myDatePicker").datetimepicker().on('changeDate', function(e) {
alert('date has changed!');
});
Bootstrap doc reference: changeDate