Bootstrap modal hide is not working

后端 未结 20 1462
温柔的废话
温柔的废话 2020-12-09 08:11

Bootstrap modal hide is not working. Alert comes in else. but my modal is not hidden Added bootply. My issue is the same one.

20条回答
  •  孤街浪徒
    2020-12-09 08:52

    I had the same problem, tried a lot of things but the only solution that worked for me is @Tang Chanrith suggested to remove individually parts of the modal but a little bit improved to place back and the scrollbar. I'll put my answer just if the accepted answer did not work for them. Sorry for my english. Hope I helped.

    @Tang Chanrith

    Try this function

    function hideModal() {
      $("#myModal").removeClass("in");
      $(".modal-backdrop").remove();
      $("#myModal").hide();
    }
    

    Improved Sollution

    You just have to delete a class from body and css that generated

    function hideModal() {
      $("#myModal").removeClass("in");
      $(".modal-backdrop").remove();
      $('body').removeClass('modal-open');
      $('body').css('padding-right', '');
      $("#myModal").hide();
    }
    

提交回复
热议问题