颜色框 href to sweetalert

colorbox href to sweetalert

我必须将彩框弹出窗口更改为 sweetalert2 弹出窗口 我的问题是我在 colorbox 中使用 href 属性来获取 HTML 内容 我在 sweetalert2

中找不到相同的方法

有解决办法吗?

谢谢

您可以使用 jquery 的 .get() Method 获取 html 数据。您需要做的是引用 html 文件。

您的 javascript 代码应如下所示。

  $.get("yourFile.html", function (data) {
     swal({
       html: data
     });
  });

祝你好运!