appendChild()

The DOM method that inserts a node as the last child of an element, moving it if it was already somewhere else.

In more detail

Each appendChild on a live page can trigger style and layout work, so adding hundreds of items one by one is slow. Build them in a DocumentFragment and append the fragment once instead.

Related terms

Taught in

References