Sunday, May 19, 2024
 Popular · Latest · Hot · Upcoming
65
rated 0 times [  71] [ 6]  / answers: 1 / hits: 15696  / 8 Years ago, thu, january 28, 2016, 12:00:00

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!


More From » html

 Answers
17

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>




[#63532] Tuesday, January 26, 2016, 9 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
zaynerogerb

Total Points: 454
Total Questions: 109
Total Answers: 97

Location: Comoros
Member since Tue, Mar 14, 2023
1 Year ago
zaynerogerb questions
;