我正在使用String.fromCharCode
向我的html文本添加新行(或)回车符。
就像,
"Ant the other line here..." + String.fromCharCode(13)
Jsfiddle 是 @ http://jsfiddle.net/udmfsvfn/
但是,页面中没有添加换行符!!
最佳答案
如果你想在 HTML 中换行,你需要提供 <br>
实体而不是换行符(您的 String.fromCharCode(13)
代码),因为 HTML 将换行符解释为文本中常见的空格。
关于javascript - 使用 fromCharCode 的 HTML 换行符不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32518546/