Javascript 如何中断java脚本中的一行

Javascript 如何中断java脚本中的一行,javascript,jquery,Javascript,Jquery,我正在通过java脚本设置h4的文本,我想做的是添加新行,下面是代码 $("#description").text("for CCAET and has received significant international scientific recognition. <br /> \n Dr. Armogan has also been responsible for many surgical firsts in retina and cataract management."

我正在通过java脚本设置h4的文本,我想做的是添加新行,下面是代码

$("#description").text("for CCAET and has received significant international scientific recognition. <br /> \n Dr. Armogan has also been responsible for many surgical firsts in retina and cataract management.");
有什么帮助吗?

试试
$(“#描述”).html(…)
而不是
$(“#描述”).text(…)
试试
$(“#描述”).html(…)
而不是
$(“#描述”).text(…)
用html代替文本。这是因为html将呈现html代码。text方法将只插入和转义所有HTML内容。参考文献

$(文档).ready(函数(){
var content=“此

修改的
文本”; $('h4#one').html(内容); $('h4#two')。文本(内容); });

这是初始文本
这是初始文本
使用html而不是文本。这是因为html将呈现html代码。text方法将只插入和转义所有HTML内容。参考文献

$(文档).ready(函数(){
var content=“此

修改的
文本”; $('h4#one').html(内容); $('h4#two')。文本(内容); });

这是初始文本
这是初始文本
使用html()函数将原始html作为

$("#description").html("for CCAET and has received significant international scientific recognition. <br /> \n Dr. Armogan has also been responsible for many surgical firsts in retina and cataract management.");
$(“#description”).html(“用于CCAET,并获得了重要的国际科学认可。
\n Armogan博士还负责视网膜和白内障治疗方面的许多外科第一。”;
使用html()函数将原始html作为

$("#description").html("for CCAET and has received significant international scientific recognition. <br /> \n Dr. Armogan has also been responsible for many surgical firsts in retina and cataract management.");
$(“#description”).html(“用于CCAET,并获得了重要的国际科学认可。
\n Armogan博士还负责视网膜和白内障治疗方面的许多外科第一。”;
使用带有标记的html函数。它将保留原始html

tag.it will preserve your raw html .

$("#description").html("<pre>for CCAET and has received significant international scientific recognition. <br /> \n Dr. Armogan has also been responsible for many surgical firsts in retina and cataract management.</pre>");
$(“#description”).html(“用于CCAET,并获得了重要的国际科学认可。
\n Armogan博士还负责视网膜和白内障治疗方面的许多外科第一。”;
使用带有标记的html函数。它将保留原始html

tag.it will preserve your raw html .

$("#description").html("<pre>for CCAET and has received significant international scientific recognition. <br /> \n Dr. Armogan has also been responsible for many surgical firsts in retina and cataract management.</pre>");
$(“#description”).html(“用于CCAET,并获得了重要的国际科学认可。
\n Armogan博士还负责视网膜和白内障治疗方面的许多外科第一。”;

对于现在使用javascript的换行符,它显示的是is@uneebmeer如果答案有效,请接受答案。对于换行符,现在在javascript中工作,它显示的是is@uneebmeer如果答案有效,请接受