toastr

how to display multi line message in the 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


Solution

  • As told by Dr.Stitch, toastr using the string as HTML, so we have to add </br> for the new line:

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

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