开发者

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

How do I write a <br/>开发者_JS百科 tag in JavaScript?


var mybr = document.createElement('br');
someElement.appendChild(mybr);

Further reading:

  • https://webplatform.github.io/docs/tutorials/traversing_the_dom/
  • https://webplatform.github.io/docs/tutorials/creating_and_modifying_html/


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

this should do the trick.


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

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

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


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

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜