appendChild()

noun

say it: “uh-PEND CHYLD” /əˈpɛnd tʃaɪld/

A DOM method that adds an element inside another one, as its last child.

What is appendChild() in JavaScript?

appendChild() — A DOM method that puts an element inside another one, after its existing children. If the element was already somewhere on the page, it moves.

const row = document.createElement("li");
row.textContent = "Chang";
document.getElementById("cart").appendChild(row);

In a sentence

  • “appendChild put the new li at the bottom of the cart list.”

Level: Apprentice · More JavaScript terms at this level

Updated