Govind Samrow Govind Samrow - 1 year ago 38
Javascript Question

Bootstrap Modal keyboard & backdrop property issue for multiple modals

I've multiple modals but keyboard: false property not working in some cases:

First event open Types model:

$('.charts').click(function () {
$('#ModalVTypes').modal({ backdrop: 'static', keyboard: false, show: true });
});


Second event open Matrics or Chart modal and hide Types model:

$('.glist a').click(function () {
$('.modal').modal('hide');
if (Type == 1) {
$('#ModalMatrics').modal({ backdrop: 'static', keyboard: false, show: true });
} else {
$('#ModalChart').modal({ backdrop: 'static', keyboard: false, show: true });

}
});


If i've use single modal its working fine.
Thanks

Answer Source

Solution has been fond:

The issue with modal hide functionality.

$('.modal').modal('hide'); //Create issue because it'll reset all properties 

Replaced this with following:

$('Model_ID').modal({ backdrop: 'static', keyboard: false, show: false});
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download