我正在尝试使用 html 选项发出甜蜜的警报:
swal({
title: "HTML <small>Title</small>!",
text: "A custom <span style="color:#F8BB86">html<span> message.",
html: true
});
但是我试过这个,而不是那个文本放一个按钮:
var boton = "button";
swal({
title: "HTML <small>Title</small>!",
text: "<input type=" + boton + ">",
html: true
});
但是没用! (我想制作一个带有选项(按钮)的菜单) 有人知道怎么做吗? 谢谢!
最佳答案
您可以使用 button
标签代替 input
。
像这样:
var boton = "button";
swal({
title: "HTML <small>Title</small>!",
text: '<button type="' + boton + '">Button</button>',
html: true
});
<link href="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.css" rel="stylesheet" />
<script src="https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.js"></script>
关于javascript - 甜蜜警报 html 选项,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/35058635/