我有一根弦,上面写着
string display_txt = "1st line text" +"\n" + "2nd line text";
在jQuery中,我try 使用
('#somediv').html(display_txt).css("color", "green")
很明显,我希望我的消息显示为2行,但却显示在\n消息中.有什么快速解决办法吗?
谢谢,
我有一根弦,上面写着
string display_txt = "1st line text" +"\n" + "2nd line text";
在jQuery中,我try 使用
('#somediv').html(display_txt).css("color", "green")
很明显,我希望我的消息显示为2行,但却显示在\n消息中.有什么快速解决办法吗?
谢谢,
使用<br />
表示html中的新行:
display_txt = display_txt.replace(/\n/g, "<br />");