[英]Javascript: How can I replace newlines from a textarea to a div element?
This jsfiddle explains it all https://jsfiddle.net/qphoria/jh7p0oq2/1/ 这个jsfiddle解释了所有这些https://jsfiddle.net/qphoria/jh7p0oq2/1/
How do I make the div appear as multiple lines without showing the literal <br>
tags? 如何使div显示为多行而不显示文字
<br>
标记?
Could probably try 可能可以尝试
$('#display').html(str);
https://jsfiddle.net/j56vdyfa/1/ https://jsfiddle.net/j56vdyfa/1/
use .html() will taking the str as html and render it. 使用.html()会将str作为html并呈现。 .text() will only render str as text.
.text()仅将str呈现为文本。
$('#display').html(str);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.