Bootstrap 3 & 4

$('#myModal').on('hidden.bs.modal', function () {
    // do something…
});

Bootstrap 3: getbootstrap.com/javascript/#modals-events

Bootstrap 4: getbootstrap.com/docs/4.1/components/modal/#events

Bootstrap 2.3.2

$('#myModal').on('hidden', function () {
    // do something…
});

See getbootstrap.com/2.3.2/javascript.html#modals → Events

Answer from Ricardo Lima on Stack Overflow
🌐
Bootstrap
getbootstrap.com › docs › 4.0 › components › modal
Modal · Bootstrap
When modals are closed, any tooltips and popovers within are also automatically dismissed. ... This button triggers a popover on click. This link and that link have tooltips on hover. ... <div class="modal-body"> <h5>Popover in a modal</h5> <p>This <a href="#" role="button" class="btn btn-secondary popover-test" title="Popover title" data-content="Popover body content is set in this attribute.">button</a> triggers a popover on click.</p> <hr> <h5>Tooltips in a modal</h5> <p><a href="#" class="tooltip-test" title="Tooltip">This link</a> and <a href="#" class="tooltip-test" title="Tooltip">that link</a> have tooltips on hover.</p> </div>
Discussions

jquery - Close Bootstrap Modal - Stack Overflow
The modal is displayed initially, but it does not close when clicked outside of the modal. Also, the content area is not greyed out.. How can I get the modal to display initially, then close after the user clicks outside the area? More on stackoverflow.com
🌐 stackoverflow.com
How do I close a modal on successful submit without jquery in Bootstrap 5?
No need to use jQuery, but you'll have to wait for the Ajax request to come back with a successful status code, which will be your cue to trigger data-bs-toggle. More on reddit.com
🌐 r/bootstrap
2
0
February 17, 2022
jQuery simple modal close issues
I am using jQuery simple modal to bring up an email subscription dialog when someone first visits a site. The modal window pops up just fine and I have it so that when someone clicks “no thanks” the window closes. What… More on sitepoint.com
🌐 sitepoint.com
0
June 13, 2013
How to trigger an event when bootstrap modal closes
🌐 forum.jquery.com
🌐
Reddit
reddit.com › r/bootstrap › how do i close a modal on successful submit without jquery in bootstrap 5?
r/bootstrap on Reddit: How do I close a modal on successful submit without jquery in Bootstrap 5?
February 17, 2022 -

I can use data-bs-toggle for the close button, but using that for a submit button won’t let me validate and submit with Ajax before closing. I do not want to redirect, page refresh or use jquery since I am using alpine js. How can I hide the modal form upon successful Ajax submit with JavaScript or alpine js?

🌐
Tutorial Republic
tutorialrepublic.com › faq › how-to-close-a-bootstrap-modal-window-using-jquery.php
How to Close a Bootstrap Modal Window Using jQuery
Click the "Close button", "cross icon" or "dark gray area" to close or hide the modal.</p> </div> <div class="modal-footer"> <button type="button" class="btn btn-primary">Close Modal</button> </div> </div> </div> </div> </div> </body> </html>
Find elsewhere
🌐
GitHub
gist.github.com › kylefox › 10913825
Close jquery-modal 5 seconds after being opened. · GitHub
Close jquery-modal 5 seconds after being opened. GitHub Gist: instantly share code, notes, and snippets.
🌐
SitePoint
sitepoint.com › javascript
jQuery simple modal close issues
June 13, 2013 - I am using jQuery simple modal to bring up an email subscription dialog when someone first visits a site. The modal window pops up just fine and I have it so that when someone clicks “no thanks” the window closes. What I am having trouble with is When someone clicks outside of the modal window it does not close.
🌐
W3Schools
w3schools.com › bootstrap › tryit.asp
Modal Events - hide.bs.modal
The W3Schools online code editor allows you to edit code and view the result in your browser
🌐
Jquerymodal
jquerymodal.com
jQuery Modal
The simplest modal you ever did see. Star · Automatic binding using HTML semantics · No images & light-weight (about 1k minified) Simple markup makes it easy to style · Attach custom behaviour using jQuery events · Close with click or ESC key · Built by @kylefox 🍸 ·
🌐
ASPSnippets
aspsnippets.com › Articles › 2516 › Close-Hide-Bootstrap-Modal-Popup-Window-using-jQuery
Close Hide Bootstrap Modal Popup Window using jQuery
September 12, 2018 - The Close Button is assigned a jQuery Click event handler and when the Close Button is clicked, the Bootstrap Modal Popup Window will be hidden (closed) using modal function and passing the parameter value hide.
🌐
Bootstrap
getbootstrap.com › docs › 5.0 › components › modal
Modal · Bootstrap v5.0
I will not close if you click outside me. Don't even try to press escape key. ... <!-- Button trigger modal --> <button type="button" class="btn btn-primary" data-bs-toggle="modal" data-bs-target="#staticBackdrop"> Launch static backdrop modal </button> <!-- Modal --> <div class="modal fade" id="staticBackdrop" data-bs-backdrop="static" data-bs-keyboard="false" tabindex="-1" aria-labelledby="staticBackdropLabel" aria-hidden="true"> <div class="modal-dialog"> <div class="modal-content"> <div class="modal-header"> <h5 class="modal-title" id="staticBackdropLabel">Modal title</h5> <button type="button" class="btn-close" data-bs-dismiss="modal" aria-label="Close"></button> </div> <div class="modal-body"> ...
🌐
jQuery
learn.jquery.com › using-jquery-core › document-ready
$( document ).ready() | jQuery Learning Center
April 23, 2024 - A page can't be manipulated safely until the document is "ready." jQuery detects this state of readiness for you. Code included inside $( document ).ready() will only run once the page Document Object Model (DOM) is ready for JavaScript code to execute. Code included inside $( window ).on( ...
🌐
freeCodeCamp
forum.freecodecamp.org › javascript
Open/close modal
April 7, 2021 - I’m trying to make a popup appear and disappear. To do this I’ve a modal like so: Modal × Soooo.. Put what ever! Then I style it: #modal { opacity: 0; border: 1px solid brown; border-radius: 10px; } #target { margin: 1px 15px; width: 27px; height: 27px; outline: none; border: 2px solid ...
🌐
SitePoint
sitepoint.com › javascript
Closing a modal on click outside of modal
July 23, 2020 - I’m trying to close a modal popup window if the user clicks anywhere outside of the modal, or the close Botton at the bottom. The close button works, but not the on click outside the modal. Here are a couple of things I’…
🌐
Write
write.corbpie.com › show-hide-bootstrap-modal-with-jquery
Show & hide Bootstrap modal with jQuery
January 14, 2021 - <button type="button" class="btn btn-success" id="modalOpen">Open</button> <button type="button" class="btn btn-warning" id="modalClose">Close</button>