Sweetalert: Possibility to display custom HTML elements

Created on 6 Oct 2014  路  7Comments  路  Source: t4t5/sweetalert

Hey,
Loving the project, but it could really use the possibility to alert custom HTML - not just text inside a

.
Good job so far!

Most helpful comment

Lazy way to do it :v:

swal("Cancelled", "Replace this title", "error");
$(".sweet-alert h2").html("With<br>this..");

All 7 comments

I think that it is not a popup plugin, just only custom alert.

@luciusodio I see. Well, it would make a kickass popup plugin as well!

Once you start adding your own HTML, I'd say it's better to just write your own customized plugin that fits your specific needs. As @luciusodio stated, SweetAlert is intended for short simple messages only. :)

@t4t5 I would also suggest you consider removing the escapeHtml directive, at least for the text part of the alert. This would let developers style their notifications with <b> tags and others. That's a big plus compared to the default javascript alert.

I would also add that the JavaScript alert() function allows you to pass in /n for line breaks. So it does allow some formatting. If there was a way of doing some very basic formatting that would be a big plus.

I customized for put an input type text in the alert, but i can't select the element for write. What can i do for solve this ?

Lazy way to do it :v:

swal("Cancelled", "Replace this title", "error");
$(".sweet-alert h2").html("With<br>this..");
Was this page helpful?
0 / 5 - 0 ratings

Related issues

rafatux picture rafatux  路  5Comments

blackrosezy picture blackrosezy  路  6Comments

daftspunk picture daftspunk  路  4Comments

mouro001 picture mouro001  路  3Comments

vmitchell85 picture vmitchell85  路  6Comments