我使用String.fromCharCode将新的行(或)回车添加到html文本中。
就像,
"Ant the other line here..." + String.fromCharCode(13)Jsfiddle是@http://jsfiddle.net/udmfsvfn/
但是,在页面中没有添加换行符!
发布于 2015-09-11 08:10:58
如果您想要在HTML中换行,您需要提供<br>实体,而不是换行(您的String.fromCharCode(13)代码),因为String.fromCharCode(13)解释行符通常是文本中的空格。
发布于 2015-09-11 08:10:30
发布于 2021-10-28 12:07:51
https://stackoverflow.com/questions/32518546
复制相似问题