Vinay Gayakwad
Vinay Gayakwad

Reputation: 536

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

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

Upvotes: 13

Views: 125011

Answers (4)

Quentin
Quentin

Reputation: 943214

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

Further reading:

Upvotes: 21

visit
visit

Reputation: 1

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

Upvotes: -2

David
David

Reputation: 218828

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

Upvotes: 1

Jake Aitchison
Jake Aitchison

Reputation: 1099

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

this should do the trick.

Upvotes: 8

Related Questions