Summary of Textarea line feed in HTML _ HTML/Xhtml _ webpage Creation

Source: Internet
Author: User
Recently, I encountered a problem about whether data can be transferred to Textrea for Row-based storage. Here I summarize whether a data transfer to Textrea for Row-based storage, here is a summary:

Problem description:
For example, if you want to get data to a TextArea, such as aaa bbb, and want to store the text in TextArea by row, instead of displaying row-based storage (the so-called real row-based storage means that the data of the TextArea is then post to the Textarea of another page, which is still stored by row)

Solution 1:
At the beginning, when submitting data, the format is AAA.
BBB, but this is a line feed. In fact, it is not actually stored by row in TextArea, because AAABBB is displayed when it is submitted to another TextArea, rather than line feed, therefore, only display and store by row

Basic Problem knowledge:
The line feed in HTML is
While the line feed of TextArea is/n.

Solution 2:
Submit data before using Javascript
And/n replace
Submitted
As Separator
After submission

The Code is as follows:


Script
// Press ENTER for line breaks
Var haha = document. getElementById ("SendTextArea"). value;
Haha = haha. replace ('
','/N ');
Document. getElementById ("SendTextArea"). value = haha;
Script


This is OK!

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.