Jquery – Disallow Twitter Bootstrap modal window from closing


I am creating a modal window using Twitter Bootstrap. The default behavior is if you click outside the modal area, the modal will automatically close. I would like to disable that — i.e. not close the modal window when clicking outside the modal.

Can someone share jQuery code to do this?

Best Solution

I believe you want to set the backdrop value to static. If you want to avoid the window to close when using the Esc key, you have to set another value.


<a data-controls-modal="your_div_id"

OR if you are using JavaScript:

  backdrop: 'static',
  keyboard: false