Bootstrap modal: close current, open new

前端 未结 27 1741
离开以前
离开以前 2020-11-29 00:23

I have looked for a while, but I can\'t find a solution for this. I want the following:

  • Open an URL inside a Bootstrap modal. I have this working off course. S
27条回答
  •  情话喂你
    2020-11-29 01:04

    Hide modal dialog box.

    Method 1: using Bootstrap.

    $('.close').click(); 
    $("#MyModal .close").click();
    $('#myModalAlert').modal('hide');
    

    Method 2: using stopPropagation().

    $("a.close").on("click", function(e) {
      $("#modal").modal("hide");
      e.stopPropagation();
    });
    

    Method 3: after shown method invoke.

    $('#myModal').on('shown', function () {
      $('#myModal').modal('hide');
    })
    

    Method 4: Using CSS.

    this.display='block'; //set block CSS
    this.display='none'; //set none CSS after close dialog
    

提交回复
热议问题