Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

how to display multi line message in the toastr ?

Tags:

toastr

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

like image 322
Trilok Pathak Avatar asked Apr 28 '16 07:04

Trilok Pathak


People also ask

How do you add a new line in toast message?

\n inside the string works!!!

What is Toastr notification?

Toast Notifications notify the user of a system occurrence. The notifications should have a consistent location in each application.


2 Answers

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.

like image 168
Trilok Pathak Avatar answered Sep 22 '22 01:09

Trilok Pathak


allowHtml: true

toastr.success('\'Second Review\' validation has started. </br>All SME\'s and Reviewers will get an email notification', '', { closeButton: true, timeOut: 4000, progressBar: true, allowHtml: true });
like image 26
Bert Avatar answered Sep 26 '22 01:09

Bert