After reading the jquery-doc the answer is fairly easy:

Change:

$('#btnModelConfirmMessage').on('click',function () {
        fun();
        $('#msgModal').modal('hide');
});

Then add a new call on the hide.bs.modal event

$('#msgModal').on('hide.bs.modal',function () {
        $('#btnModelConfirmMessage').off();
});

This removes the previously added handler, so we do not stack-up the events.

Hope someone will find this usefull :))

Cheers, Daniel

Answer from Daniel on Stack Overflow
🌐
Bootstrap
getbootstrap.com › docs › 4.6 › components › modal
Modal · Bootstrap v4.6
Bootstrap 4 has reached end of life. Upgrade to the latest or consider Never-Ending Support for your project. ... Use Bootstrap’s JavaScript modal plugin to add dialogs to your site for lightboxes, user notifications, or completely custom content.
🌐
Bootstrap
getbootstrap.com › docs › 4.0 › components › modal
Modal · Bootstrap
Use Bootstrap’s JavaScript modal plugin to add dialogs to your site for lightboxes, user notifications, or completely custom content.
Discussions

Bootstrap 4 Modal as Confirm Revisited
I wanted to make a "flexible" confirm dialog with Bootstrap 4 as I do not want to hardcode each confirm modal / action on its own. So, with a standard Modal like More on stackoverflow.com
🌐 stackoverflow.com
jquery - Open Bootstrap 4 Modal via JavaScript by clicking a link - Stack Overflow
I want to open a modal when I click on a link. Unfortunately I couldn't change the HTML of the link. I could only change the content of href. Like this: Open modal More on stackoverflow.com
🌐 stackoverflow.com
bootstrap 4 modal
jose macedo is having issues with: when i click on my button for modal, my modal pops up but everything shifts to the left on my index.html please help More on teamtreehouse.com
🌐 teamtreehouse.com
1
October 4, 2016
Using Modal Dialog Boxes in Bootstrap 4

Not sure this article adds much more than the official documentation for the modal component...

https://getbootstrap.com/docs/4.1/components/modal/

More on reddit.com
🌐 r/webdev
1
0
March 3, 2015
🌐
TutorialsPoint
tutorialspoint.com › bootstrap4 › bootstrap4_modal.htm
Bootstrap 4 - Modal
A static modal window example is shown in the following example − · <html lang = "en"> <head> <!-- Meta tags --> <meta charset = "utf-8"> <meta name = "viewport" content = "width = device-width, initial-scale = 1, shrink-to-fit = no"> <!-- Bootstrap CSS --> <link rel = "stylesheet" href = "https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity = "sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin = "anonymous"> <title>Bootstrap 4 Example</title> </head> <body> <div class =" container"> <h2>Basic Modal</h2> <br> <!-- Button trigg
🌐
W3Schools
w3schools.com › bootstrap4 › bootstrap_modal.asp
Bootstrap 4 Modals
<!-- Button to Open the Modal --> <button type="button" class="btn btn-primary" data-toggle="modal" data-target="#myModal"> Open modal </button> <!-- The Modal --> <div class="modal" id="myModal"> <div class="modal-dialog"> <div class="modal-content"> <!-- Modal Header --> <div class="modal-header"> <h4 class="modal-title">Modal Heading</h4> <button type="button" class="close" data-dismiss="modal">&times;</button> </div> <!-- Modal body --> <div class="modal-body"> Modal body..
Find elsewhere
🌐
W3Schools
w3schools.com › bootstrap4 › bootstrap_ref_js_modal.asp
Bootstrap JS Modal Reference
The following table lists all available modal events. ... If you want to use W3Schools services as an educational institution, team or enterprise, send us an e-mail: sales@w3schools.com · If you want to report an error, or if you want to make a suggestion, send us an e-mail: help@w3schools.com · HTML Tutorial CSS Tutorial JavaScript Tutorial How To Tutorial SQL Tutorial Python Tutorial W3.CSS Tutorial Bootstrap Tutorial PHP Tutorial Java Tutorial C++ Tutorial jQuery Tutorial
🌐
GeeksforGeeks
geeksforgeeks.org › bootstrap › explain-modal-in-bootstrap-4
Explain modal in Bootstrap 4 - GeeksforGeeks
July 23, 2025 - Modal is one of the components of Bootstrap 4 built with HTML, CSS, and JavaScript and is a lightweight, responsive JavaScript plugin used to add dialogs, user notifications, lightboxes, or just custom content to the site.
🌐
Bootstrap
getbootstrap.com › docs › 4.0 › components › navbar
Navbar · Bootstrap
<div class="pos-f-t"> <div class="collapse" id="navbarToggleExternalContent"> <div class="bg-dark p-4"> <h4 class="text-white">Collapsed content</h4> <span class="text-muted">Toggleable via the navbar brand.</span> </div> </div> <nav class="navbar navbar-dark bg-dark"> <button class="navbar-toggler" type="button" data-toggle="collapse" data-target="#navbarToggleExternalContent" aria-controls="navbarToggleExternalContent" aria-expanded="false" aria-label="Toggle navigation"> <span class="navbar-toggler-icon"></span> </button> </nav> </div>
🌐
SitePoint
sitepoint.com › blog › bootstrap › understanding bootstrap modals
Understanding Bootstrap Modals — SitePoint
November 6, 2024 - No JavaScript coding is necessary as all code and styles are predefined by Bootstrap. Modals can be activated with jQuery by calling the .modal() function on the modal’s selector, with the option to customize behavior through a JavaScript object.
🌐
Laravel
livewire.laravel.com › docs › 4.x › upgrading
Upgrade Guide | Laravel Livewire
In v3, wire:model would respond to input/change events that bubbled up from child elements. This caused unexpected behavior when using wire:model on container elements (like modals or accordions) that contained form inputs—clearing an input inside would bubble up and potentially close the modal.
🌐
Bootstrap
getbootstrap.com › docs › 4.0 › utilities › borders
Borders · Bootstrap
Use border utilities to quickly style the border and border-radius of an element. Great for images, buttons, or any other element.
🌐
Drupal
drupal.org › project › bootstrap4_modal
Bootstrap 4 Modal | Drupal.org
February 13, 2024 - This module provides a bootstrap modal. Compatible with bootstrap 4 and bootstrap 5 themes.
🌐
Font Awesome
fontawesome.com
Font Awesome
The internet's icon library + toolkit. Used by millions of designers, devs, & content creators. Open-source. Always free. Always awesome.
🌐
MDBootstrap
mdbootstrap.com › standard › modal
Bootstrap Modal - free examples & tutorial
Utilize the Bootstrap grid system within a modal by nesting .container-fluid within the .modal-body. Then, use the normal grid system classes as you would anywhere else. Launch demo modal · .col-md-4 · .col-md-4 .ms-auto · .col-md-3 .ms-auto · .col-md-2 .ms-auto ·
🌐
UseBootstrap
usebootstrap.org › lang-en › components › modal
Modal
<template> <!-- Button trigger modal --> <b-button color="primary" toggle="modal" target="#exampleModal" > Launch demo modal </b-button> <!-- Modal --> <Modal id="exampleModal"> <ModalDialog> <ModalContent> <ModalHeader> <ModalTitle>Modal title</ModalTitle> <CloseButton dismiss="modal" /> </ModalHeader> <ModalBody>...</ModalBody> <ModalFooter> <b-button color="secondary" dismiss="modal" > Close </b-button> <b-button color="primary"> Save changes </b-button> </ModalFooter> </ModalContent> </ModalDialog> </Modal> </template>
🌐
Tailwind CSS
tailwindcss.com › plus › ui-blocks › application-ui › overlays › modal-dialogs
Tailwind CSS Modal Dialogs - Official Tailwind UI Components
Use these Tailwind CSS modal dialog components to create pop-up boxes for things like alerts, notifications, or confirmation prompts.
🌐
Team Treehouse
teamtreehouse.com › community › bootstrap-4-modal
bootstrap 4 modal (Example) | Treehouse Community
October 4, 2016 - jose macedo is having issues with: when i click on my button for modal, my modal pops up but everything shifts to the left on my index.html please help