Bootstrap modal background doesn’t disappear when modal closes

print
This can happen in certain circumstances for a lot of reasons.  If you need a quick and dirty hack to get everything shut down (modal wise) in full, you can use:

$('#your-modal-id').modal('hide');
$('body').removeClass('modal-open');
$('.modal-backdrop').remove();

It’s overkill, but effective.

Share this post:
Related Posts
Disable and enable buttons (Bootstrap) using a jQuery extension
Adding tabbed panels to Bootstrap – No jQuery
3 Comments
  • abdullah
    Dec 21,2018 at 7:35 am

    it works mine.
    $(‘#your-modal-id’).remove();
    $(‘body’).removeClass(‘modal-open’);
    $(‘.modal-backdrop’).remove();

  • Tiffany
    Sep 26,2018 at 9:41 am

    Thanks for sharing this. Ive been looking for a “failsafe” method to shut modals down. Tiff

  • Clint
    Sep 21,2018 at 9:05 am

    Might be overkill, but it gets the job done.

Leave a Comment