Bootstrap Modal – How to stop modal from closing when clicking outside

bootstrap modal are built with html,css and js. they are positioned over everything. They are used to add dialogs to our website.

To prevent bootstrap modal from closing when clicking outside it we can use following code

1 : Using Html

<a data-controls-modal="your_modal_div_id" data-backdrop="static" data-keyboard="false" href="#">Click</a>

2: Using Javascript

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

Read more about bootstrap modal