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
1. Use basic text elements to mark up content Fir...
First is the idea We use the <input type="...
1. Space rules Whitespace within HTML code is usu...
1. Regular expression matching ~ for case-sensiti...
Table of contents Start Docker Stop Docker Python...
Table of contents 1. A simplest server-side examp...
Why do you need to learn CSS overflow mechanism i...
Preface As you know, Linux supports many file sys...
Attribute check-strictly The official document pr...
Code <div class="test"> <div&g...
Use MySQL proxies_priv (simulated role) to implem...
This article shares the installation and configur...
This article example shares the specific code of ...
Table of contents Overview Implementation Protect...
Effect picture: 1. Introduction Your own applet n...