如何用<br/>标记替换字符串中的所有换行符?
如何使用Javascript从值中读取换行符,并将所有换行符替换为br标签?
br
例子:
从PHP传递的变量如下所示:
"This is man. Man like dog. Man like to drink. Man is the king."
在Javascript转换之后,我希望我的结果看起来像这样:
"This is man<br /><br />Man like dog.<br />Man like to drink.<br /><br />Man is the king."
芜湖不芜
相关分类