本文介绍了甜蜜警报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 =cdnjs.cloudflare/ajax/libs/sweetalert/1.1.3/sweetalert.min.css =stylesheet/>< script src =https:// cdnjs .cloudflare / 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="cdnjs.cloudflare/ajax/libs/sweetalert/1.1.3/sweetalert.min.css" rel="stylesheet" /> <script src="cdnjs.cloudflare/ajax/libs/sweetalert/1.1.3/sweetalert.min.js"></script>
更多推荐
甜蜜警报html选项
发布评论