如何在 JavaScript 中编写 <br/> 标签?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/4803967/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-08-23 14:10:37  来源:igfitidea点击:

How do I write a <br/> tag in JavaScript?

javascript

提问by Vinay Gayakwad

How do I write a <br/>tag in JavaScript?

如何<br/>在 JavaScript 中编写标签?

回答by Jake Aitchison

document.write('<br/>');

this should do the trick.

这应该可以解决问题。

回答by David

document.write('<br />');

Or, since no Stack Overflow question on JavaScript would be complete without jQuery...

或者,因为没有 jQuery,关于 JavaScript 的堆栈溢出问题将是不完整的......

http://www.thenerdary.net/post/20965430596/beautiful-element-creation-with-jquery

http://www.thenerdary.net/post/20965430596/beautiful-element-creation-with-jquery

回答by visit

Use the operator + in the document.write(var1 + "text" + and the break tag);

在 document.write(var1 + "text" + 和 break 标签中使用运算符 +);