How to prevent Bootstrap modal from closing when clicking outside
The default configuration of Bootstrap modal is can be closed when visitor click outside the modal or by pressing the escape (ESC) key. If you want to prevent boostrap modal from closing by those actions, you need to change the value of backdrop and keyboard configuration. You may also like Simple Bootstrap Modal and How to close bootstrap modal popup using jquery.
In HTML, just set data-backdrop to static and data-keyboard to false
Code
$('#myModal').modal({
backdrop: 'static',
keyboard: false
});
Leave a Reply