Bladephp: Now with 7+ codeigniter, php, and laravel project 7+ php project From $18/Year From Rs. 1000/Year

How to prevent Bootstrap modal from closing when clicking outside

by
Category:javascript
php mysql javascript
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
});

0 Comments


Html code work in comment box


Related Post