1
swal({
  title: "Etsi ohjelmaa!",
  text: "Kirjoita ohjelman nimi:",
  type: "input",
  showCancelButton: true,
  closeOnConfirm: true,
  animation: "slide-from-top",
  inputPlaceholder: nimi
}

我试过onClose: $("sweet-alert").removeClass()了,但它不起作用。我也应该删除类“甜蜜覆盖”。

那么如何在对话框关闭后从 DOM 中删除 Sweet-alert 呢?

https://sweetalert2.github.io/

4

2 回答 2

0

SweetAlert2 关闭后自行删除,证明:

确保您使用的是最新版本。

于 2017-08-01T10:54:05.203 回答
0

swal的,关闭时自行删除,但您可以通过编程方式执行此操作

   swal({
          title: "Etsi ohjelmaa!",
          text: "Kirjoita ohjelman nimi:",
          type: "input",
          showCancelButton: true,
          closeOnConfirm: true,
          animation: "slide-from-top",
          inputPlaceholder: nimi
        ,
          onClose: function () {
            if($("sweet-alert"))
            $("sweet-alert").remove();
          }
        })

而不是removeClass()你上面写的

于 2017-08-01T11:24:23.117 回答