Bootstrap 3 modal does not close on outside click
You can pass options to the modal as :
$('#myModal').modal({
show:true,
backdrop:true,
keyboard:true
})
I have written custom code to solve this.
$("body").on("click", ".modal-dialog", function(e) {
if ($(e.target).hasClass('modal-dialog')) {
var hidePopup = $(e.target.parentElement).attr('id');
$('#' + hidePopup).modal('hide');
}
});
Just add data-backdrop="static"
and data-keyboard="false"
attributes to that modal (ie where you have class='modal'
)
data-backdrop="true"
is the default behaviour that allows for background click dismissal and data-backdrop="static"
is the behaviour that your explaining, no dismissal, so probably you have set it somewhere to "static".
data-keyboard="false"
is for not allowing ESC