2
The title is already very explanatory. But I would like to know how I close a modal only by the close button and the "x" of the window, not allowing the user to click on the black background around the pop up window to close.
HTML:
<!-- Button trigger modal -->
<button type="button" id="mymodal" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">
Launch demo modal
</button>
<!-- Modal -->
<div class="modal fade" id="myModal" tabindex="-1" role="dialog" aria-labelledby="myModalLabel">
<div class="modal-dialog" role="document">
<div class="modal-content">
<div class="modal-header">
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</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>
Well that’s right thanks man!
– Marcelo T. Cortes
Also add the property
data-keyboard="false"
to avoid being closed with the keyboard.– Pedro Camara Junior
Truth I just checked this problem kkkk thanks too Pedro!
– Marcelo T. Cortes
As for documentation, as Maurivan said, it is always worth reading: http://getbootstrap.com/javascript/#modals-options
– Pedro Camara Junior
Good Luck Pedro!
– Maurivan