Friday, May 17, 2024
64
rated 0 times [  71] [ 7]  / answers: 1 / hits: 47300  / 10 Years ago, wed, november 5, 2014, 12:00:00

I'm using bootbox to show dialog.



If I use bootbox.confirm, bootbox.alert or bootbox.prompt, when pressing escape key or clicking outside the dialog, the dialog closed as expected



but when using bootbox.dialog, when I click outside the dialog or pressing escape key, the dialog doesn't close, how to make it behave as other dialog do?



var box = bootbox.dialog({
show: false,
backdrop: true,
animate: false,
title: 'Bla',
message: 'bla bla bla',
buttons: {
cancel: {
label: 'Cancel',
className: 'btn-warning'
},
save: {
label: 'Parse',
className: 'btn-success',
callback: function () {
// handling with ajax
return false;
}
}
}
});
box.modal('show');

More From » twitter-bootstrap-3

 Answers
13

This should do it. Please note this has only been tested on v3. using bootstrap 2.3.2



$(document).on('click', '.modal-backdrop', function (event) {
bootbox.hideAll()
});

[#68905] Monday, November 3, 2014, 10 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
jessie

Total Points: 713
Total Questions: 87
Total Answers: 109

Location: Australia
Member since Sat, May 27, 2023
1 Year ago
;