How can I read the line break from a value with JavaScript and replace all the line breaks with <br />
tags?(如何使用JavaScript从值读取换行符并将所有换行符替换为<br />
标记?)
Example:(例:)
A variable passed from PHP as below:(从PHP传递的变量如下:)
"This is man.
Man like dog.
Man like to drink.
Man is the king."
I would like my result to look something like this after the JavaScript converts it:(我希望我的结果在JavaScript转换后看起来像这样:)
"This is man<br /><br />Man like dog.<br />Man like to drink.<br /><br />Man is the king."
ask by Jin Yong translate from so
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…