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
background In the early stages of learning Japane...
Table of contents 1. Introduction: In this case, ...
Find the problem Today at work, when copying tabl...
I chose node.js to build the server. Friends who ...
Performance For example: HTML: <div class=&quo...
Table of contents Preface Six features of JSON.st...
What I bring to you today is to use jQuery to imp...
1. Before configuring the IP address, first use i...
The first line of a Docker image starts with an i...
Today a junior student asked a question. The HTML...
The methods of installing nginx and multiple tomc...
The preparation for the final exams in the past h...
Table of contents What is the Picker component Pr...
Introduction <br />Not everyone has access t...