Sweetalert 2: new line in text

Mi Guoliang

It’s different between the two API swal(title, text) and swal(option) on showing multi line text.

    const lines = ['line_1', 'line_2', 'line_3'];
    swal(lines.join('<br>')); // it works
    swal({ text: lines.join('<br>') }); // it does not work

Note: for Sweetalert2 Version 8.x and higher, the API has changed to Swal.fire(...).

If you like my share, you can:

• Follow My Programming Experiences Page on Facebook.

• Follow My Twitter.

• Subscribe to my mail list.