Recently, I encountered a problem of whether the data can be truly 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", and want to store this text in the TextArea in real lines, rather than displaying it in lines (the so-called real line storage means that the data of this TextArea is still stored in lines when it is posted to the Textarea of another page) Problem Solved 1: When the data is submitted at the beginning, the format is AAA<BR />BBB, but this is to display line breaks. In fact, it is not really stored in rows in the TextArea. Because when it is submitted to another TextArea, it will display AAABBB instead of line breaks. Therefore, it is only displayed as stored in rows. Question Basics: The line break in HTML is <BR />, while the line break in TextArea is /n Problem Solved 2: Submit the data first and then use Javascript to replace <BR /> and /n. When submitting, <BR /> is still used as a separator. After submitting, Copy code The code is as follows:<script> // Line break and carriage return var haha=document.getElementById("SendTextArea").value; haha=haha.replace(' ','/n'); document.getElementById("SendTextArea").value=haha; </script> That’s it! |
<<: How can the front end better display the 100,000 pieces of data returned by the back end?
>>: 28 Famous Blog Redesign Examples
Table of contents 1. Docker distributed lnmp imag...
Overview: The filesystem module is a simple wrapp...
Table of contents Written in front Several storag...
1. Meaning of partition table A partition table d...
Table of contents 1. Introduction 2. Use 1. @Comp...
Table of contents 1. Current limiting algorithm 2...
First of all, you need to know some characteristi...
<br />I have written two articles before, &q...
.NET SDK Download Link https://dotnet.microsoft.c...
introduction With the widespread popularity of In...
Table of contents Preface Arrow Functions Master ...
This article introduces the characteristics of CS...
This article example shares the specific code of ...
This article shares with you a graphic tutorial o...
Table of contents Main issues solved 1. The data ...