how to display multi line message in the toastr ?

Trilok Pathak picture Trilok Pathak · Apr 28, 2016 · Viewed 19k times · Source

How to display multi line error message in the toastr ??

I have formatted my error message like below

"Please fix the following: \r\nFirst Name is required\r\nLast Name is required\r\nEmail Address is required\r\n"

But in the toasrt it shows in the single line. Please help

Answer

Trilok Pathak picture Trilok Pathak · Apr 28, 2016

As told by Dr.Stitch , toastr using the string as html so we have to add for the new line :

Please fix the following: </br>First Name is required</br>Last Name is required</br>Email Address is required</br>

- An update: 15/12/2020:

For the version 12+ :

toastr.success('Please fix the following: </br>First Name is required</br>Last Name is required</br>Email Address is required</br>', '', { closeButton: true, timeOut: 4000, progressBar: true, allowHtml: true });

This will work !!! thank you for the help.