问题描述
|
这个问题已经在这里有了答案:
解决方法
使用
.html()
代替.text()
,使用.html()
代替.text()
。
,尝试:
$(\'#divname\').html(\"code\");
,解决这个问题,
我首先需要一个var htmlCode,将其转换为解码HTML代码,然后使用html函数……谢谢大家。
var htmlCode = $(\"<p/>\").html(\"line:1 3spaces b4<br /><br />line:3 5spaces b4<br /> 5spaces b4,line: 4\").text();
$(\"#aaa\").html(htmlCode);