question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

modal('show') after a modal('hide') doesn't work

See original GitHub issue

immediately after hiding a modal, if a show call is issued it doesn’t work e.g.

$('#show_modal').click(function(){
   $('#test-modal').modal('show')
   $('#test-modal').modal('hide')
   $('#test-modal').modal('show')
})

​ Looks like end effect should be a modal dialog shown, but instead modal is hidden with a black screen see it in action here http://jsfiddle.net/anuraguniyal/qzAmP/

For time being I am working around it by issuing a setTimeout of 1000 msec, because looks like bootstrap takes 500 msec to hide modal in a timeout

Issue Analytics

  • State:closed
  • Created 11 years ago
  • Comments:20 (1 by maintainers)

github_iconTop GitHub Comments

34reactions
EricWarnkecommented, Jun 22, 2012

Have you tried using

$('#test-modal').show().on('shown', function() { 
    $('#test-modal').modal('hide') 
});
15reactions
canteroalejandrocommented, Oct 15, 2012

Hi, I have tried this as follows.

$(“.btn-plus”).click(function(){ $(‘#new_passenger’).modal(“show”).on(‘hide’, function() { $(‘#new_passenger’).modal(‘hide’) }); });

I worked. sorry for my english… =)

Read more comments on GitHub >

github_iconTop Results From Across the Web

Bootstrap modal hide is not working - Stack Overflow
So your click is firing the modal show as your data attributes set, and your Javascript does not affect this trigger.
Read more >
modal.show not working - MSDN
Hi I'm using bootstrap modal dialog. If I use like this. <a class="last" href="#login-modal" data-toggle="modal"> ...
Read more >
Bootstrap 5 Modal Show, Close, Hide & Toggle - free examples
Modal Backdrop ; hide, Manually hides a modal. Returns to the caller before the modal has actually been hidden (i.e. before the hidden.mdb.modal...
Read more >
Modal - Bootstrap
How it works · Modals are built with HTML, CSS, and JavaScript. · Clicking on the modal “backdrop” will automatically close the modal....
Read more >
Modal Events - hide.bs.modal - W3Schools Tryit Editor
The hide.bs.modal event occurs modal is about to be hidden. Click the "Hide Modal" button to trigger the hide method (which will trigger...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found