• support@answerspoint.com

Prevent Bootstrap Modal from disappearing when clicking outside or pressing escape?

2659

I'm using the Twitter Bootstrap modal as a wizard window, and would like to prevent the user from closing it when clicking outside of the modal or when pressing escape. Instead, I want it to be closed when the user presses the finish button. How could I achieve this scenario?

2Answer


0

Works too, data-backdrop="static" to click out and data-keyboard="false" to Esc in your div modal:

<div id="idModal" class="modal hide" data-backdrop="static" data-keyboard="false">

 

  • answered 6 years ago
  • Community  wiki

0

If using JavaScript then:

$('#myModal').modal({
    backdrop: 'static',
    keyboard: false
})

and if HTML:

<a data-controls-modal="your_div_id" data-backdrop="static" data-keyboard="false" href="#">

 

  • answered 6 years ago
  • Community  wiki

Your Answer

    Facebook Share        
       
  • asked 6 years ago
  • viewed 2659 times
  • active 6 years ago

Best Rated Questions