Please wait...

How to disabled out side click on bootstrap model

@HTML  @ CSS  @ JAVASCRIPT  @ Bootstrap  @ Model  @ Disable  @ Out side  

# How to disabled out side click on bootstrap model

 Bootstrap model HTML code

Make sure that you have import bootstrap library . Mease bootstrap.css or bootstrap.min.css And bootstrap.js or bootstrap.min.js

Button trigger modal

<button type="button" class="btn btn-primary btn-lg" data-toggle="modal" data-target="#myModal">Launch demo modal</button>

Modal Box

<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">&times;</span></button>

<h4 class="modal-title" id="myModalLabel">Modal title</h4>


  <div class="modal-body">



  <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>







You have to add this two data attributes in the button.

data-backdrop="static" data-keyboard="false"

Using jQuery CODE

You have to add same as below script in your model script.

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

For the Run Code Click Below link


Comments 0