Activate the content as a Bootstrap modal

If you want to set content as a Bootstrap modal, then use the .modal(options) method.

On button click, the modal generates as in the following script.

$(document).ready(function(){
  $("#button1").click(function(){
    $("#newModal1").modal({backdrop: true});
  });
});

Above, I have set options as "backdrop:true". Another option, we can set is "backdrop: true" ?

backdrop: true =  Clicking outside the modal, close it.
backdrop: false = Clicking outside the modal, won?t close it.


You can try to run the following code to implement the modal("options") class ?

Example


  
    Bootstrap Example
    
    
    
    
    
  
  
    
     

Sample

                   
Updated on: 2026-03-11T22:50:42+05:30

573 Views

Kickstart Your Career

Get certified by completing the course

Get Started
Advertisements