snipplets.dev/code/JavaScript/DOM/addElements.js

4 lines
137 B
JavaScript

let newDiv = document.createElement('div');
newDiv.appendChild(document.createTextNode('some text'));
document.body.appendChild(newDiv);