繁体   English   中英

无法将字符串拆分为新行

[英]Unable to split a string into a new line

文档太多了,我看了几十篇文章。 我不知道我做错了什么,但本质上我想做的是在多行范围内显示文本:

跨度:

 <span style="color:red" id="errors"></span>


 var errText = "<b>NOTE:</b>  There are " + "<b>" + errors.length + "</b>" + “ issues that must be addressed. Please make changes as necessary.";

目标是让这段文字看起来像这样:

 NOTE: There are 3 issues that must be addressed.
 Please make changes as necessary.

我正在尝试使用,我已经尝试过 \n 但似乎没有任何效果。

例 1:

var errText ="<b>NOTE:</b>  There are " + "<b>" + errors.length + "</b>" + “ issues that must be addressed.\n Please make changes as necessary.";

例 2:

var errText ="<b>NOTE:</b>  There are " + "<b>" + errors.length + "</b>" + “ issues that must be addressed.\ 
 Please make changes as necessary.";

我究竟做错了什么?

 <span>NOTE: There are 3 issues that must be addressed. <br> Please make changes as necessary</span>

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM