Ok I solved this. Maybe it is not the best solution, but it is working for my special case.
I added $('#myModal').off('click');
just after I show loading spinner on submit. This prevents from closing modal with mouse click.
There was a problem with disabling escape
button, because browsers stops page loading when user press this button. So I decided to hide the spinner to unlock the form with this code:
$(document).on('keydown',function(e) {
if (e.keyCode == 27) {
$('#myLoadingSpinner').hide();
}
});
Edit:
I found another solution for backdrop:
$('#myModal').data('bs.modal').options.backdrop = 'static';
I tried this also for keyboard = false
, but it doesn't work.
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…