When click on datepicker (http://www.eyecon.ro/bootstrap-datepicker/), his SHOW event fires, but the modal's SHOW.BS.MODAL fires too. Whhere is a problem?
$(document).ready(function() {
$('#ArrDate')
.datepicker()
.on("show", function(event){
alert("Q");
});
$("#dlg3000to3100")
.on('show.bs.modal', function (event) {
alert("W");
});
$("#dlg3000to3100")
.modal("show");
});
exampleExample
Thanks
It seems to be a bug (or feature?) of the datepicker. What you can do is to prevent the
show.bs.modal
event reaching the dialog.This will detect the event at the datepicker level and stop the event propagation, so
show.bs.modal
will not 'bubble up' to the dialog.Another work around is to swap the show.bs.modal with shown.bs.modal on modal event.
however if it is not possible to swap show with shown or hide with hidden use the namespace check
});
Had a similar issue, caused by the datepicker watching for a show event.
One option is to use the shown event on the modal but this is not ideal in all cases
A more elegant solution is to check the namespace of the event
https://jsfiddle.net/bzh75tww/