If I set the next line in a div, how can I make the new line work in HTML?
{ "s": "Phrase1. \ n \ nPhrase2" }
Thank.
foo.innerHTML = myObj.s.replace(/\n/g,"<br>");
Trim pre-formatted text into <pre> tags:
<pre>{ "s":"Phrase1.\n\nPhrase2" }</pre>
Shows how:
{"s": "Phrase1. Phrase2 "}
Edit: Another option is to set the style or class of the div like the pre tag:
<div style="whitespace:pre"/>
{"s", "phrase1.<br /><br />"phrase2"}
Source: https://habr.com/ru/post/1783127/More articles:PostgreSQL: синтаксис левого внешнего соединения - outer-joinORM, DataBinding for DataGridView: insert / delete new rows not stored in the database - c #What is the easiest way to make configuration files in Java? - javaNested ERB template templates such as Liquid? - layoutMySql: разумно ли использовать "представление", или я бы лучше денормализовал свою БД? - mysqlHow to visually display b-tree in java? - javadisplay mysql newline in HTML - htmlWhy doesn't font color adjustment work? - htmlEF4 Include () with projection - linq-to-entitiesNo query results - sqlAll Articles