Bootstrap modal hide is not working

后端 未结 20 1369
温柔的废话
温柔的废话 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:47

    try to add return false like this:

    $("#buy").click(function () { 
      var a = 4;
      if (a == 5) {
        alert("if");
        $('#myModal').modal('show');
      }
      else {
        alert("else");
        $('#myModal').modal('hide');
      }
      return false;
    });
    

提交回复
热议问题