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

If using JavaScript then:

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

or in HTML:

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

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">

You can Use Direct in bootstrap model also.

<div class="modal fade" id="myModal" data-keyboard="false" data-backdrop="static">