HTML newline using fromCharCode is not working

前端 未结 2 978
野性不改
野性不改 2021-01-26 09:39

I am using String.fromCharCode to add new line (or) carriage return to my html text.

It is like,

\"Ant the other line here...\" + String.fro         


        
2条回答
  •  渐次进展
    2021-01-26 10:00

    If you want a line break in HTML you need to supply
    entity instead of a line break (your String.fromCharCode(13) code) since HTML interprets line breaks as usual spaces in text.

提交回复
热议问题