I have HTML <textarea>that I want to do when the user clicks on an input in a text field, it causes a line to appear when the line is stored in a variable and printed on the page.
<textarea>
How should I do it? I have seen this before, but I'm not sure how to do it.
When you read the contents of a text field, simply do the following:
var text = document.getElementById(textAreaId).value.replace("\n","<br/>");
That way, when you use variable text, it will be able to break lines in html.
white-space pre. . : http://www.w3schools.com/CSS/pr_text_white-space.asp
white-space
pre
<p style="white-space: pre;">Your text with newlines goes here.</p>
<pre>, HTML, white-space: pre; , .
<pre>
white-space: pre;
<br /> . , HTML .
<br />
, HTML, <br> <pre>.
<br>
<pre> .pre ( Courier), , .
<pre> .
pre ( Courier), , .
Source: https://habr.com/ru/post/1771368/More articles:Writing a DLL for C # and C ++ Applications - c ++Binding ListView DataTemplate ListView - wpfWhat is the best way to wrap our library of software to serve both C ++ and C # client applications? - c ++Snap Silverlight animation to Click button - silverlightEntity Framework 4 and synonyms - c #Best way to display large amounts of text? - androidVB6 "Invalid Property Use" error, where the code seems fine - vb6Two-dimensional core density estimator in Java - javaDLL Monitoring - c ++How to create a Raster from a float float array in Java? - javaAll Articles