下面和上面是发生的 3 个步骤。
var newcontent = $("#commenthere").val();
alert(newcontent)
$('#commentarea').replaceWith(newcontent);
我想要的是当内容被附加/替换时,无论如何,它显示
1
2
在页面上而不是1 2
我尝试用 using 替换\n
,<br>
但replace
它不起作用,因为它会导致语法错误,因为它将 javascript 代码移动到新行,从而破坏了函数。