Focusing on a Bootstrap Datepicker field should not trigger the "show.bs.modal" event.
Focusing on a Bootstrap Datepicker field triggers "show.bs.modal" event.
It happens for "hide.bs.modal" also.
Datepicker - 1.8.0
Bootstrap 4.0
Please is there an update on this. I'm also having similar issue.
Thanks.
@papakay as a workaround you can use this:
$('#register-modal').on('hidden.bs.modal', function(event){
if ($(event.target).is('#register-expires-at-field')) { // the id of the element with datepicker
return;
}
//
});
Than you very much @alexandrubau for the trick, you saved my day!!! :+1:
Anyway, I noticed the problem is actually with the modal opening (not closing), so I had to correct your solution with the event show.bs.modal.
Here is my working code:
$('#register-modal').on('show.bs.modal', function(event) {
if ($(event.target).is('#register-expires-at-field')) { // the id of the element with datepicker
return;
}
// ...
});
Most helpful comment
@papakay as a workaround you can use this: