I was stuck on this for a while also. I have no idea why but when I used data-bs-dismiss
in stead of data-dismiss
in the class for the close button it worked for me.
data-dismiss
is on Bootstrap 4.x version whiledata-bs-dismiss
is on Bootstrap 5.x version.
Please see below full code for close button.
<button type="button" class="btn btn-secondary" data-bs-dismiss="modal">Close</button>
Related Contents:
- Launch Bootstrap Modal on Page Load
- Bootstrap modal: is not a function
- Scrolling issues with multiple bootstrap modals
- Can one AngularJS controller call another?
- Pass mouse events through absolutely-positioned element
- How to check whether a Storage item is set?
- How can I capture the right-click event in JavaScript? [duplicate]
- How to focus on a form input text field on page load using jQuery?
- Custom attributes – Yea or nay?
- Enter triggers button click
- How to disable HTML button using JavaScript?
- How do I stop a web page from scrolling to the top when a link is clicked that triggers JavaScript?
- How do I create a link using javascript?
- Adding onClick event dynamically using jQuery
- How do I create a new line in Javascript?
- How to programmatically empty browser cache?
- JavaScript: Get image dimensions
- Is it possible to access an SQLite database from JavaScript?
- How to simulate a click by using x,y coordinates in JavaScript?
- How to draw polygons on an HTML5 canvas?
- Text blinking jQuery
- HTML Drag And Drop On Mobile Devices
- How to show popup message like in Stack Overflow
- Why don’t browsers throw an error when any other word is used in place of ‘javascript’ in the value of onclick?
- How much data / information can we save / store in a QR code?
- How do you use window.postMessage across domains?
- How to run html file on localhost?
- Popstate on page’s load in Chrome
- make html text input field grow as I type?
- How to draw an oval in html5 canvas?
- How to set radio button status with JavaScript
- How to open specific tab of bootstrap nav tabs on click of a particuler link using jQuery?
- Want HTML form submit to do nothing
- Can I dynamically set tabindex in JavaScript?
- Twitter bootstrap collapse: change display of toggle button
- How to move table row in jQuery?
- What are “data-require” “data-semver” in HTML files?
- How to set a value for a selectize.js input?
- Reading cookie expiration date
- Nested and multiple troubles
- Get input type=”file” value when it has multiple files selected [duplicate]
- How can I set preview of video file, selecting from input type=’file’
- Prevent href=”#” link from changing the URL hash
- How can I make reCAPTCHA a required field?
- How to modify the first pageNumber or execute JS in header or footer template with Chrome DevTools Protocol’s printToPDF
- Retrieving HTML5 video duration separately from the file
- Autocompletion in ACE editor
- Stray start tag script
- HTML5 Drag and Drop anywhere on the screen
- Angular JS: How to load js files in partials