Tag Archives: bootstrap modal disable esc key

Disable bootstrap modal window from closing


Disable bootstrap modal window from closing : You can disable the bootstrap modal from closing.


Disable bootstrap modal window from closing Syntax

Add the following jquery to make your bootstrap modal disable from closing.

$(modal-selector).modal({
  backdrop: 'static',
  keyboard: true
})

Where modal-selector is id of your modal. You can also disable keyboard closing by setting keyboard parameter as false.

$(modal-selector).modal({
  backdrop: 'static',
  keyboard: false
})

Disable bootstrap modal window from closing : Example

$("#tutorialsplaneModal").modal({
  backdrop: 'static',
  keyboard: true
})

Try it »