I am trying to use a simple bootstrap modal, but it closes on clicking it anywhere, and not on clicking on the close button only. I haven't used any other extra javascript or jquery code on the page. Here's the link where my code is. The modal trigger button is on the bottom.
http://aijaz.co/angloamerican/
This is the default code I am using.
<a data-toggle="modal" href="#myModal" class="btn btn-primary btn-large">Launch demo modal</a>
<div id="myModal" class="modal fade">
<div class="modal-dialog">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-hidden="true">×</button>
<h4 class="modal-title">Confirmation</h4>
</div>
<div class="modal-body">
<p>Do you want to save changes you made to document before closing?</p>
<p class="text-warning"><small>If you don't save, your changes will be lost.</small></p>
</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>
Add data-backdrop="static"
as an attribute
of myModal
. See http://getbootstrap.com/javascript/#modals-options for more details.
Try to put data-backdrop="true"
on your #myModal
element.
Like this:
<div id="myModal" class="modal fade" data-backdrop="true">
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With