Closed koullislp closed 7 years ago
If you set the html
property to true
, then you can use line breaks --> the <br/>
tag.
How I do this?
swal({ html: true, title: 'hi', text: 'te<br>st' });
doesn't seem to work for me
p.s i used pr https://github.com/t4t5/sweetalert/pull/772 for much simplified usage, everything is ok now
How should I set html property to true? what is the order of html property and why is it not documented? Thank you.
It works if you set the html
property to the actual html itself (i.e. get rid of the text
property and set the html
property to the html content), e.g.
$swal({
title: "My title",
type: "error",
html: "My text with<br />html included"
});
It works for me, use \n swal("Oops", "Line 1.\n line2.", "error");
it works just in part of text like this :
swal("Oops", "Line 1.\n line2.", "error");
but if you want to make it in part of title .. it dosn't work :
swal("Oops\nOops", "Line 1", "error");
sorry, but in my opnion doesnt make sense use multiple lines in title (and following a good design spec).
EDIT: and thanks @themightystephen
swal({ buttons: ["Wait ", "Add Details"], html: true, text: "Text one .\n Text 2.\n Text 3." })
Here is the solution. Works perfectly in react. Enjoy
What the title says, please??