Bootstrap modal – disable closing with ESC key or mouse

Must Read : Bootstrap modal – disable closing with ESC key or mouse

With Twitter Bootstrap modals in either version 2 or 3, you can easily prevent the modal window from being closed with the escape key or by clicking on the black backdrop outside the window.

This is useful for keeping people inside of a wizard or other multi-step process inside of a modal box.

Disable the keyboard (ESC key) and mouse clicks outside window

Adding the attributes of data-keyboard="false" and data-backdrop="static" to your modal div will keep the escape key from closing the window.

Add to HTML element

OR control with JavaScript

(Visited 151 times, 1 visits today)

Leave a Comment.