DOM Nodes
Create, insert, and remove nodes with DOM methods. Build a node before attaching it to the page.
Where to run this
This example changes a document. Open it in the HTML playground, then select Run code. It runs inside a separate preview.
A practical example
<ul id="tasks">
<li>
Measure
</li>
</ul>
<script>
const item = document.createElement("li");
item.textContent = "Cut";
document.getElementById("tasks").append(item);
</script>
What happens
Cut is added as a second list item.