1

When I open a jQuery.confirm plugin modal on a bootstrap modal and then close it; the focus on the launching bootstrap modal gets lost. (The focus moves to the background) so I cannot scroll on the bootstrap modal anymore. How can I solve this?Can sb tell me please?Can I ask it to explicitely set focus on boostrap modal not the background?

function deleteRelationship(e)   
{  
        var grid = this;  
        var loadRelationDeletePopup = function () {  
            e.preventDefault();  
            var dataItem = grid.dataItem($(e.currentTarget).closest("tr"));  
            var id = dataItem.ID;  
            var formdata = "ID=" + id;   
        $.ajax({  
            url: '@Url.Action(MVC.Role.ActionNames.DeleteRelationship, MVC.Role.Name)',
            type: 'POST',  
            data: formdata,  
            success: function (result) {                      
                $("#relationshipsGrid").data('kendoGrid').dataSource.read();  
            }  
        });  
        return false;  
    }  
    notify.Confirm("Warning", "Are you sure", loadRelationDeletePopup);  
}

notify.Confirm(title,message,handler method) wraps a jQuery.modal.

ekad
  • 14,436
  • 26
  • 44
  • 46
seti
  • 11
  • 3

1 Answers1

0

User below. Works for me

$(document).on('hidden.bs.modal', '.modal', function () {
    $('.modal:visible').length && $(document.body).addClass('modal-open');
});

For more information check this Multiple modals overlay

Community
  • 1
  • 1
Mir Gulam Sarwar
  • 2,588
  • 2
  • 25
  • 39
  • Thanks, however I have difficulty understanding some parts of bootstrap codes. I understood from this link: [link](https://github.com/nakupanda/bootstrap3-dialog/issues/70) the problem which is ".modal-open" class being closed when closing second modal ,But I don't know what does $('.modal:visible').length do and why you have added 'modal-open' to $(document.body) but not the underneath modal? – seti Aug 08 '16 at 06:38