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

If using JavaScript then:

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

in case of ‘show’

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

or in HTML:

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

Leave a Comment