甜蜜警报html选项

Mir*_*uez 5 html javascript css sweetalert

我正在尝试使用html选项发出甜蜜警报:

swal({  
   title: "HTML <small>Title</small>!",  
   text: "A custom <span style="color:#F8BB86">html<span> message.",   
   html: true 
});
Run Code Online (Sandbox Code Playgroud)

但是没有那个文字放一个按钮,我试过这个:

var boton = "button";
swal({   
    title: "HTML <small>Title</small>!",  
    text: "<input type=" + boton + ">",  
    html: true 
});
Run Code Online (Sandbox Code Playgroud)

但它不起作用!(我想制作一个带有选项的菜单(按钮))是否有人知道如何做这样的事情?谢谢!

Mos*_*Feu 8

您可以使用button标签代替input.

像这样:

var boton = "button";
swal({   
    title: "HTML <small>Title</small>!",  
    text: '<button type="' + boton + '">Button</button>',
    html: true 
});
Run Code Online (Sandbox Code Playgroud)
<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>
Run Code Online (Sandbox Code Playgroud)