---
title: "How to Disable click outside of bootstrap modal area to close modal?"  
description: "How to Disable click outside of bootstrap modal area to close modal?"  
author: "Manish Kumar"  
published: 2017-05-22  
updated: 2017-05-23  
canonical: https://www.mindstick.com/forum/34299/how-to-disable-click-outside-of-bootstrap-modal-area-to-close-modal  
category: "c#"  
tags: ["mvc4", "bootstrap modal"]  
reading_time: 1 minute  

---

# How to Disable click outside of bootstrap modal area to close modal?

I am designing a [website](https://www.mindstick.com/articles/13110/why-copywriting-is-crucial-for-new-website-build) through [bootstrap](https://www.mindstick.com/articles/1555/image-viewer-using-bootstrap-carousel), with a couple of Bootstrap 'Modals'. I have [Problem](https://yourviews.mindstick.com/view/81399/tackling-the-problem-of-unemployment-during-corona-pandemic), I can [close](https://yourviews.mindstick.com/story/1687/rubbing-hands-close-up-benefits) the [modal](https://www.mindstick.com/interview/660/explain-modal-dialog-box) by clicking on the background. Is there any way to [disable](https://www.mindstick.com/forum/12901/how-to-disable-enable-input-box-in-aspx-with-value-from-sql) this [feature](https://www.mindstick.com/articles/12788/how-to-boost-sales-using-magento-2-checkout-feature)? Please help!!!

| \ |
| --- |

| down vote |  |
| --- | --- |

## Replies

### Reply by Jayden Bell

\

If you opening the modal by js, use:

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

If you are using data attributes, use:

```
<div id="Mymodal-Create" class="modal fade
bd-example-modal-lg"
tabindex="-1" role="dialog" data-backdrop="static" data-keyboard="false" aria-labelledby="myLargeModalLabel" aria-hidden="true">            <div class="modal-dialog modal-lg">                <div class="modal-content">                    <div class="modal-header">                        <button type="button" class="close" data-dismiss="modal" aria-hidden="true">                            &times;                        </button>                        <h4 class="modal-title">Create                        </h4>                    </div>                    <div class="modal-body" id="Create-Body">                    </div>                     <div class="modal-footer">                        <input type="Submit" class="btn
btn-primary"
id="btnsubmit"  value="Add" />                        <button type="button" class="btn
btn-default"
data-dismiss="modal">                            Close                        </button>                     </div>                 </div>                <!-- /.modal-content
-->            </div>            <!-- /.modal-dialog -->         </div>
```


---

Original Source: https://www.mindstick.com/forum/34299/how-to-disable-click-outside-of-bootstrap-modal-area-to-close-modal

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
