---
title: "How to stop closing of Bootstrap modal popup outside click"  
description: "How to stop closing of Bootstrap modal popup outside click"  
author: "Anonymous User"  
published: 2014-09-30  
updated: 2014-09-30  
canonical: https://www.mindstick.com/forum/2291/how-to-stop-closing-of-bootstrap-modal-popup-outside-click  
category: "bootstrap"  
tags: ["jquery", "html", "css-css3", "bootstrap"]  
reading_time: 1 minute  

---

# How to stop closing of Bootstrap modal popup outside click

I have a [bootstrap modal](https://www.mindstick.com/forum/33715/need-code-for-crud-operations-using-jquery-ajax-and-bootstrap-modal-popup-using-asp-dot-net-mvc) popup in my [application](https://www.mindstick.com/articles/12824/calculator-application-in-android), it closes when i [click](https://www.mindstick.com/articles/12423/social-login-magento-2-one-click-to-register-social) on outside of [modal popup](https://www.mindstick.com/articles/13038/crud-operation-searching-paging-in-mvc-with-modal-popup), I only want that modal popup closes on click of [cross](https://www.mindstick.com/forum/33892/how-to-handle-cross-thread-exception-in-winforms) [button](https://www.mindstick.com/articles/63/how-to-add-button-in-datagridview-in-csharp-dot-net) and close button**\****below is my code:**\

```
<div class="container">    <br />    <br />    <button class="btn btn-primary" id="launchmodal" data-toggle="modal" data-target="#myModal">        Launch demo modal    </button></div> <!-- Modal --><div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel" aria-hidden="true">    <div class="modal-dialog">        <div class="modal-content">            <div class="modal-header">                <button type="button" class="close" data-dismiss="modal"><span aria-hidden="true">&times;</span><span class="sr-only">Close</span></button>                <h4 class="modal-title" id="myModalLabel">Modal title</h4>            </div>            <div class="modal-body">                ...            </div>            <div class="modal-footer">                <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>                <button type="button" class="btn btn-primary">Save changes</button>            </div>        </div>    </div></div>
```

**Here is my [javascript](https://www.mindstick.com/articles/874/how-to-create-watermark-text-for-textbox-by-using-javascript) code:**

```
<script>    $(document).ready(function () {        $('#launchmodal').click(function () {            $('#myModal').modal({                keyboard: false            })        });    }); </script>
```

## Replies

### Reply by Anonymous User

Hi pawan shuklai'm solve your problem you can use this code

<script>

$(document).ready(function () {

$('#launchmodal').click(function () {

$('#myModal').[modal](https://www.mindstick.com/interview/660/explain-modal-dialog-box)({

backdrop: 'static',

keyboard: false,

})

});

});

</script>


---

Original Source: https://www.mindstick.com/forum/2291/how-to-stop-closing-of-bootstrap-modal-popup-outside-click

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
