Skip to content
Related Articles

Related Articles

How to use modal closing event in Twitter Bootstrap ?

Improve Article
Save Article
Like Article
  • Last Updated : 18 Jun, 2020

Bootstrap Modals offer a lightweight, multi-purpose JavaScript popup that’s customizable and responsive. They can be used to display alert popups, videos, and images in a website. Bootstrap Modals are divided into three primary sections: header, body, and footer.


class | tabindex | role | aria-labelledby

Approach: It shows the pop-up menu with the header, body, and footer with the close and submits button.

<div class="modal fade" 
    <div class="modal-dialog" role="document">

Explanation: Below is a static modal example (meaning its position and display have been overridden) including the modal header, modal body (required for padding), and modal footer (optional). We ask that you include modal headers with dismiss actions whenever possible, or provide another explicit dismiss action.


<!DOCTYPE html>
    <link rel="stylesheet" 
    <script src=
    <script src=
    <!-- Button trigger modal -->
    <button type="button" class="btn btn-primary" 
            data-toggle="modal" data-target="#exampleModal">
        Launch demo modal
    <!-- Modal -->
    <div class="modal fade" id="exampleModal" tabindex="-1"
         role="dialog" aria-labelledby="exampleModalLabel" 
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" 
                      Modal title
                    <button type="button" class="close" 
                            data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">×</span>
                <div class="modal-body">
                <div class="modal-footer">
                    <button type="button" class="btn btn-secondary" 
                    <button type="button" class="btn btn-primary">
                      Save changes</button>

$('#myModal').on('', function () {


Supported Browsers: It supports in Flex layout.

  • Chrome: Yes
  • Firefox: Yes (63.0)
  • Edge: No
  • Internet Explorer: No

My Personal Notes arrow_drop_up
Recommended Articles
Page :

Start Your Coding Journey Now!