Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for new lines in message? #374

Closed
koullislp opened this issue Jun 3, 2015 · 9 comments
Closed

Support for new lines in message? #374

koullislp opened this issue Jun 3, 2015 · 9 comments

Comments

@koullislp
Copy link

What the title says, please??

@djm61
Copy link

djm61 commented Jun 3, 2015

If you set the html property to true, then you can use line breaks --> the <br/> tag.

@t4t5 t4t5 closed this as completed Sep 8, 2017
@dann1609
Copy link

How I do this?

@FALL1N1
Copy link

FALL1N1 commented Nov 26, 2017

swal({ html: true, title: 'hi', text: 'te<br>st' });
doesn't seem to work for me

p.s i used pr #772 for much simplified usage, everything is ok now

@Eugene-Melbourne
Copy link

How should I set html property to true? what is the order of html property and why is it not documented? Thank you.

@themightystephen
Copy link

themightystephen commented Sep 28, 2018

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"
});

@paokodo
Copy link

paokodo commented Feb 27, 2019

It works for me, use \n
swal("Oops", "Line 1.\n line2.", "error");

@wafa-code
Copy link

wafa-code commented Sep 17, 2019

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");

@Matheus-Ribeiro95
Copy link

Matheus-Ribeiro95 commented Apr 16, 2020

sorry, but in my opnion doesnt make sense use multiple lines in title (and following a good design spec).

EDIT: and thanks @themightystephen

@CaptRango
Copy link

CaptRango commented Nov 17, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests