Prevent Bootstrap Modal From ClosingPosted on
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
keyboard configuration. The default value of backdrop and keyboard is set to
In HTML, just set
<button type="button" data-toggle="modal" data-target="#myModal" data-backdrop="static" data-keyboard="false">Launch modal</button>
I use Bootstrap v3.2.0 when this article is written. More information about Bootstrap modal.