Summary of Line Breaking Problems in Textarea in HTML_HTML/Xhtml_Web Page Production

WBOY
Release: 2016-05-16 16:38:41
Original
1488 people have browsed it

Recently I encountered a problem about whether data can be stored row by row when transferred to Textrea. Here is a summary:

Problem description:
For example, get data into a TextArea, such as "AAA BBB", I want to store this text in the TextArea in rows, instead of displaying it and storing it in rows (the so-called true storage in rows means, then post the data of this TextArea to the Textarea of ​​another page or in rows) Storage)

Problem Solution 1:
When the data was submitted at the beginning, the format was AAA
BBB, but this showed line breaks. In fact, it was not really stored by lines in TextArea. Because when it is submitted to another TextArea at this time, it will display AAABBB instead of line breaks, so it will only display the storage by lines

Basic knowledge of the problem:
Line breaks in HTML are
, and the line break of TextArea is /n

Problem Solution 2:
Submit the data first and then use Javascript to replace
and /n
It is still when submitting
as delimiter
and then after submission

Copy the code
The code is as follows:

<script> <br>//Line break and carriage return<br>var haha=document.getElementById("SendTextArea").value; <br>haha=haha.replace('<br> ','/n'); <br>document.getElementById("SendTextArea").value=haha; <br></script>

That's OK!
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template