我在用this https://sweetalert.js.org/在我的应用程序中。我想使用如下所示的甜蜜警报。
swal({
title: "Are you sure?",
text: "You are going to delete <b>"+ name +"</b> address. ",
icon: "warning",
buttons: true,
dangerMode: true,
})
但它现在起作用了。它正在显示 HTML 代码。谢谢。
Update
I read this https://stackoverflow.com/questions/26838965/sweet-alert-display-html-code-in-text问题,但这个问题是关于甜蜜警报2 https://sweetalert2.github.io。我的问题是关于甜蜜的警报 https://sweetalert.js.org。两者都是甜蜜的警觉,但两者并不相同。
正如@Elnoor提到的,你可以尝试使用html,但我在SWAL2中遇到了问题,所以我使用了innerHTML。喜欢 :
var myhtml = document.createElement("div");
myhtml.innerHTML = "You are going to delete <b>"+ name +"</b> address. ";
然后将其放入 swal 中的内容中,如下所示:
swal({
title: "Are you sure?",
content: myhtml,
icon: "warning",
buttons: true,
dangerMode: true,
})
标记我改变了text
tag to content
tag.
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)