HTML newline using fromCharCode is not working

前端 未结 2 977
野性不改
野性不改 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:21

    The reason that a newline character is not forcing a new line, is that in HTML a newline character doesnt do anything and is ignored.

    In order to force text onto a new line, you will need to add the appropriate HTML tag, such as
    or put your text inside paragraphs

    .

    See the updated fiddle.

提交回复
热议问题