Basically I'm using a div with contenteditable
as a text box. Now when I input a newline (By pressing enter) it doesn't counts it and escaps it.
Jsfiddle: https://jsfiddle.net/pgsp7q57/3/
You can input:
Hello
How are you
And see the result by yourself which is( hellohow are you
) But I need to get the result as:
Hello
How are you
All replies are much appreciated.
Try this code .
var hello = "hello<br>how\nare\nyou";
document.getElementById("hey").innerHTML = hello;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.