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);
精彩评论