Skip to content

Learn how to close modal in Bootstrap choosing one of a few ways: click on a backdrop, close icon, or close button. You can also use JavaScript hide method.

Notifications You must be signed in to change notification settings

mdbootstrap/bootstrap-how-to-close-modal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 

Repository files navigation

How to close modal in Bootstrap?

There are few ways to close modal in Bootstrap: click on a backdrop, close icon, or close button. You can also use JavaScript hide method.

<!-- Button trigger modal -->
<button
  type="button"
  class="btn btn-primary"
  data-mdb-toggle="modal"
  data-mdb-target="#exampleModal"
>
  Launch demo modal
</button>

<!-- Modal -->
<div
  class="modal fade"
  id="exampleModal"
  tabindex="-1"
  aria-labelledby="exampleModalLabel"
  aria-hidden="true"
>
  <div class="modal-dialog">
    <div class="modal-content">
      <div class="modal-header">
        <h5 class="modal-title" id="exampleModalLabel">
          Modal title
        </h5>
        <button
          type="button"
          class="btn-close"
          data-mdb-dismiss="modal"
          aria-label="Close"
        ></button>
      </div>
      <div class="modal-body">...</div>
      <div class="modal-footer">
        <button type="button" class="btn btn-secondary" data-mdb-dismiss="modal">
          Close
        </button>
        <button type="button" class="btn btn-primary">
          Save changes
        </button>
      </div>
    </div>
  </div>
</div>

Much more examples and a detailed description can be found at 📄 Documentation page

About

Learn how to close modal in Bootstrap choosing one of a few ways: click on a backdrop, close icon, or close button. You can also use JavaScript hide method.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published