This should be a database storage problem. Check the data type of the fields where you store these contents. Also refer to this article http://www.webtag123.com/sql/23888.html
If you mean putting it in the HTML structure without line breaks, then possible problems and solutions:
Because HTML is br newline and does not support the escape character n. The carriage return and line feed in the textarea are not visible, and the line feed is done through n. console.log('your query data') Check whether there is a line break in the console. Or yourCon.indexOf("n") to see if there is n. If so, yourCon.replace("n","<br/>") completes the replacement and then checks whether it is a newline. Of course, line breaks may also be r, nrbr换行,不支持转义字符n。textarea里回车换行时不可见的,是通过n换行的。 console.log('你的查询数据') 看是否在控制台有换行。或者 yourCon.indexOf("n")查看是否有n。若有的话, yourCon.replace("n","<br/>")完成替换, 再检查是否换行。当然换行也可能是r、 nr
If the first method cannot be solved. Or no line breaks appear at all. Then just replace("n","<br/>") and replace n with br in advance. Or just replace it with other characters before storing it in the database, and then convert it back when getting it.
🎜
🎜Click here to see my blog. I wrote a simple summary when I encountered this problem last time🎜
Dynamic join <p> or
This should be a database storage problem. Check the data type of the fields where you store these contents. Also refer to this article http://www.webtag123.com/sql/23888.html
When outputting, include <pre>
or replace the line break in the query content with
If you mean putting it in the HTML structure without line breaks, then possible problems and solutions:
Because HTML is
br
newline and does not support the escape charactern
. The carriage return and line feed in the textarea are not visible, and the line feed is done throughn
.console.log('your query data')
Check whether there is a line break in the console. OryourCon.indexOf("n")
to see if there isn
. If so,yourCon.replace("n","<br/>")
completes the replacement and then checks whether it is a newline. Of course, line breaks may also ber
,nr
br
换行,不支持转义字符n
。textarea里回车换行时不可见的,是通过n
换行的。console.log('你的查询数据')
看是否在控制台有换行。或者yourCon.indexOf("n")
查看是否有n
。若有的话,yourCon.replace("n","<br/>")
完成替换, 再检查是否换行。当然换行也可能是r
、nr
如果第一种不能解决。或者完全没有换行符的出现。那就就把数据
replace("n","<br/>")
,提前把n
换成br
replace("n","<br/>")
and replacen
withbr
in advance. Or just replace it with other characters before storing it in the database, and then convert it back when getting it. 🎜 🎜Click here to see my blog. I wrote a simple summary when I encountered this problem last time🎜