JavaScript 2025 · DOM and browser

Create and add an element

Build an element and append it to the page.

const li = document.createElement("li");
li.textContent = "New item";
list.append(li);

Official JavaScript 2025 documentation

More dom and browser commands

All dom and browser commands · JavaScript 2025 cheatsheet

Was this page helpful?