Remove the right backdrop.

If anybody adds a new modal in the `then()` part of the promise, without
this code, all `.modal-backdrop` elements will be deleted, and further
dialogs will not be modal; with this, only the current modal's backdrop
will be deleted.
This commit is contained in:
Jairo Llopis 2015-11-24 18:45:41 +01:00 committed by Christophe Matthieu
parent e9fc7353d2
commit 7f230a540e
1 changed files with 4 additions and 2 deletions

View File

@ -137,15 +137,17 @@
dialog.modal('show');
field.focus();
dialog.on('click', '.btn-primary', function () {
var backdrop = $('.modal-backdrop');
def.resolve(field.val(), field, dialog);
dialog.remove();
$('.modal-backdrop').remove();
backdrop.remove();
});
});
dialog.on('hidden.bs.modal', function () {
var backdrop = $('.modal-backdrop');
def.reject();
dialog.remove();
$('.modal-backdrop').remove();
backdrop.remove();
});
if (field.is('input[type="text"], select')) {
field.keypress(function (e) {