Just remove the data toggle in the html tag and write the

$('#myModal').modal('show')
or
$('#myModal').modal('toggle')

Answer from Praveen Kumar Rejeti on Stack Overflow
🌐
Reddit
reddit.com › r/css › [bootstrap]modal not showing
r/css on Reddit: [Bootstrap]Modal not showing
January 6, 2016 -

I feel like this should be rather simple, but I can't figure it out and it's starting to drive me crazy.

I am using Bootstrap (on the Java Play framework if that matters) and trying to make a simple modal. I copied a tutorial I found online, but for some reason the modal just won't show.

Here is the portion of code in question:

<body>
    <div id="Header">
        <div class="row text-right">
            <a id="login-button" data-toggle="modal" data-target="#loginModal" type="button">Login</a>
        </div>
    </div>
        <!-- Modal -->
    <div class="modal fade" id="loginModal" tabindex="-1" role="dialog" aria-labelledby="loginModal" 
                     aria-hidden="true">
        <div class="modal-dialog modal-sm">
                <!-- Modal content-->
            <div class="modal-content">
                <div class="modal-header">
                    <button type="button" class="close" data-dismiss="modal" 
                                          aria-hidden="true">&times;</button>
                    <h4 class="modal-title" id="myModalLabel">Small Modal</h4>
                </div>
                <div class="modal-body">
                    <h3>Modal Body</h3>
                </div>
                <div class="modal-footer">
                    <button type="button" class="btn btn-default" data-dismiss="modal">Close</button>
                    <button type="button" class="btn btn-primary">Save changes</button>
                </div>
            </div>

        </div>
    </div>
    @content
</body>

Can anyone see what might be causing it to fail?

Edit: So I was looking at the CSS and for some reason the Bootstrap .modal class has display:none and .fade has opacity defaulted to 0. I can mess around in the browser tools and change that, but i'm not sure how to fix it permanently.

🌐
MDBootstrap
mdbootstrap.com › standard › material design for bootstrap 5 & vanilla javascript
Modal not working - Material Design for Bootstrap
If I open the file and remove display: none, the modal shows fine, but I can't close nor trigger it from the button. It seems to be related to the fade. ... Hello, It seems that the <div class="fixed-action-btn"> is causing you problem. If you remove this div the pink button works fine. Try maybe positioning it in CSS. Regards, ... In the meantime I've "fixed" it like this. But still looking for a working solution without jQuery . $('#trigger').click(function () { $('#basicExample').modal({show : true}); });
🌐
Bootstrap
getbootstrap.com › docs › 4.1 › components › modal
Modal · Bootstrap
The modal plugin toggles your hidden content on demand, via data attributes or JavaScript. It also adds .modal-open to the <body> to override default scrolling behavior and generates a .modal-backdrop to provide a click area for dismissing shown modals when clicking outside the modal.
🌐
Reddit
reddit.com › r/bootstrap › modal not showing
r/bootstrap on Reddit: Modal not showing
May 28, 2022 -

Hey!

This is my first post here.

I usually code in Python, where make small flask projects(websites) that's when i use Bootstrap.

My issue right now is that i have a frontpage where i display some messages written on ad admin page. The admin has to be able to delete post, that's where i'm using a modal.

link to the code: https://pastebin.com/SunUyKnf

EDIT: Link to main template, base.html https://pastebin.com/3XMRMzFZ

the HTML also contains jinja for displaying backend data.

I actually got help maybe a week ago with the modal, because it wasnt selecting the id of the post to delete.

I fixed that with {{ post.id }}

After that it worked! i was able to delete posts from the frontpage using the modal it was great!, so i went on to work on the look of the webpage, since i had mostly just been doing the backend stuff first.

then 2 days ago i just wanted to test it for a reason i can't remeber, and then it freakin didn't work anymore .I have been trying to solve the issue on and off for about 2 days.

I am about to loose my mind over this issue.

first it worked then it didn't and i havent touched the page since it worked, i don't get it.

I know it's modal that 's the problem because i've tested my backend and it works.

delete route:

@/app.route('/home/<int:post_id>/delete', methods=['POST','GET'])
@/login_required 
def delete_post(post_id): 
post = Post.query.get(post_id) 
if current_user.is_authenticated: 
db_session.delete(post) 
db_session.commit() 
flash('Post has been deleted','success') 
return redirect(url_for('home')) 
return redirect(url_for('home'))

If i put in the URL /home/post.id/delete and press enter it will delete the post matching the id.

I thought this was the right place to ask, even though there is a bit of Python involved.

i sincerely hope somone here is able to help me, an i well apologies in advance if it's just some lame stupid mistake that i completety missed.

🌐
Codeply
codeply.com › p › qikoyVgKHL
Bootstrap 5 modal not working (solved) on Codeply
HTML, CSS, JavaScript editor playground for designers & developers to compare, prototype and test frontend frameworks
Find elsewhere
🌐
Bootstrap
getbootstrap.com › docs › 5.3 › components › modal
Modal · Bootstrap v5.3
The modal plugin toggles your hidden content on demand, via data attributes or JavaScript. It also overrides default scrolling behavior and generates a .modal-backdrop to provide a click area for dismissing shown modals when clicking outside the modal.
🌐
Bootstrap
getbootstrap.com › docs › 5.0 › components › modal
Modal · Bootstrap v5.0
The modal plugin toggles your hidden content on demand, via data attributes or JavaScript. It also overrides default scrolling behavior and generates a .modal-backdrop to provide a click area for dismissing shown modals when clicking outside the modal.
🌐
Mobirise Forums
forums.mobirise.com › discussion › 16117 › bootstrap-modal-doesnt-show-up-something-must-be-wrong
Bootstrap modal doesn't show up... Something must be wrong. - Mobirise Forums
I have written already a tutorial for a different software, but it is the same to use it in Mobirise (you will find a 'Google -Translate' button at the bottom of my tutorial page): nof-tutorials.com/PHP-Webseitenschutz/Tutorial/tutorial.html This script has been written by my friend Werner Zenk where you can download all scripts free and use wherever you want at: "Herunterladen (download): php_webseitenschutz.zip" werner-zenk.de/archiv/php_webseitenschutz.php ... so the only part you would copy into the "modal" area would be the <form> part.
🌐
GitHub
github.com › ga-wdi-boston › game-project › issues › 249
Bootstrap Modal not appearing on button press · Issue #249 · ga-wdi-boston/game-project
September 7, 2016 - I am trying to get a modal to appear when the sign up button is pressed. The modal does not appear when the button is clicked in the UI. I copied and pasted the code from the bootstrap website and targeted the modal by id with the sign up button I created. I think the problem has to do with my button being within a form.
Author   hantungy
🌐
Team Treehouse
teamtreehouse.com › community › modal-not-displaying-although-i-followed-the-video-exactly
Modal not displaying although I followed the video exactly (Example) | Treehouse Community
December 31, 2022 - I was having the same issue, but was able to resolve it by updating the CSS and JS cdn links used in the workspace to the current Bootstrap version, here: https://getbootstrap.com/docs/5.3/getting-started/download/ The attributes in the version used in the video are missing "bs-". ... <button type="button" class="btn btn-primary btn-lg" data-bs-toggle="modal" data-bs-target="#register">Register Now</button>
🌐
GitHub
github.com › shlomiassaf › ngx-modialog › issues › 280
Modal not showing when used with Bootstrap V4 · Issue #280 · shlomiassaf/ngx-modialog
January 11, 2017 - I spent some time wondering why the modal would not show on screen, now I found out and I want to share my insights in case anyone has the same problem. The reason was a breaking change in Bootstrap 4.0.0-alpha.6. In earlier Versions, class="fade ...
Author   nielsboecker