甜蜜警报html选项 [英] Sweet alert html option

查看:261
本文介绍了甜蜜警报html选项的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图用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
});

但它不工作!
(我想做一个类似菜单的选项(按钮))
有人知道如何做这样的事情吗?
谢谢!

解决方案

可以使用按钮



像这样:



div class =snippetdata-lang =jsdata-hide =false>

  var boton =button; swal({title:HTML< small> Title< / small> ;!,text:'< button type ='+ boton +'> / button>',html:true});  

  ; link href =https://cdnjs.cloudflare.com/ajax/libs/sweetalert/1.1.3/sweetalert.min.css =stylesheet/>< script src =https:// cdnjs .cloudflare.com / ajax / libs / sweetalert / 1.1.3 / sweetalert.min.js>  


I'm trying to make an sweet alert with the html option:

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

But instead of that text put a button, I have tried this one:

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

but it doesn't work! (I want to make something like a menu with options(the buttons)) Does anybody know how to do something like that? Thanks!

解决方案

You can use button tag instead of input.

Like this:

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>

这篇关于甜蜜警报html选项的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆