Appearing datepicker behind the modal
$('#dispatch_modal').on('shown.bs.modal', function() { $('input:text:visible:first').focus(); // prepare datepicker $('.form_datepicker').daterangepicker({ singleDatePicker: true, showDropdowns: true, parentEl: '#dispatch_modal' }); });
Source: stackoverflow.com