javascript create element in a new line 1

javascript create element in a new line

var br = document.createElement("br");
element.appendChild(br);

Here is what the above code is Doing:
1. Create a new element
2. Create a new text node
3. Append the text node to the element
4. Append the element to the document body
5. Create a new line break
6. Append the line break to the element
7. Append the element to the document body

Similar Posts