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
HTMLview code
<div id="modal_id" role="dialog" aria-hidden="true" data-backdrop="static" data-keyboard="false"> |
OR control with JavaScript
JAVASCRIPTview code
$('#modal_id').modal({ backdrop: 'static', keyboard: true }); |
Thanks..
It is working for me..Thanks…
Thanks, this lead me to the angular solution I needed…
Adding the two properties to my $uibModel.open({}) call:
let _modalInstance = $uibModal.open({ animation: true, […], backdrop: ‘static’, keyboard: false });
Thanks a lot ..
Thanks……
Very helpful 🙂
In the JavaScript example it should be keybord: false
Thank you my friend.