I am using onsen alert for displaying error messages in javascript. here is my code
var error="";
error = error.concat('\n\u2022',"FIRST LINE");
error = error.concat('\n\u2022',"SECOND LINE");
ons.notification.alert({message: error});
in output, i am getting bullets but they don't come in new line. i don't know how can i get message in new line in onsen alert. further, if i print same string with default javascript alert, all works fine. the lines do comes in new line. if anyone knows what's wrong/alternative solution then please do comment.
You can use HTML in your alert if you use the messageHTML
parameter:
var error = '\u2022 FIRST LINE <br> \u2022 SECOND LINE';
ons.notification.alert({
messageHTML: error
});
if you want an unordered list instead of bullet characters you can us the <ul>
tag.
var error = '<ul style="text-align: left"><li>FIRST LINE</li><li>SECOND LINE</li></ul>';
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments