JavaUser JavaUser - 2 years ago 151
Javascript Question

Mustache js line break

I am passing a text with line break to mustache but while rendering the line breaks are not shown. Please let me know , how to add line breaks in the text.

var test ="test1"+"\n"+"test2"+"\n"+"test3".

I am passing this to Mustache for rendering and expecting this should get printed like


But the actual result is
while rendering this.


Answer Source

You should use <br> but in your mustache template you must use {{{myString}}} to escape html

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download