I need to create a <br /> tag dynamically with javascript.
<br />
var br = document.createElement('br');
And
var br = document.createElement('<br />');
doesn't work
The first option urrently creates a <br> tag on the page which doesn't pass XHTML standards, is there anyway around this?
<br>
The first method does not need to pass XHTML standards - you're confusing markup with manipulating the DOM.
2.1m questions
2.1m answers
60 comments
57.0k users