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
If you want a line break in HTML you need to supply <br>
entity instead of a line break (your String.fromCharCode(13)
code) since HTML interprets line breaks as usual spaces in text.
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 <BR>
or put your text inside paragraphs <p>
.
See the updated fiddle.