Favorites

DOM Element.append() Method

☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee
Element.append()
DOM Element MethodThis method is supported by all modern browsers.
Updated 28th November 2026

The append() method adds one or more nodes or text strings to the end of an element.

Description

The append() method inserts nodes or strings after the last child of the element. Unlike appendChild(), it accepts several arguments at once and plain strings, which are added as text nodes (so they're safe from HTML injection). It returns undefined.

Like appendChild(), appending a node that's already in the page moves it. Appending a DocumentFragment inserts its children. If you need a reference to the new element, create it first, append it, and keep the variable, since append() returns nothing.

replaceChildren() takes the same kinds of arguments but removes the existing children first, which is a clean way to replace all the content of an element at once.

Syntax

element.append(param1, param2, ...)

Parameters

  • param1, param2, ...Nodes or strings to add at the end. Strings are inserted as text.

Return Value

None (undefined).

Example

<p id="p">Start</p>
const p = document.getElementById('p');
const strong = document.createElement('strong');
strong.textContent = 'bold';
p.append(' and some ', strong, ' text.');
console.log(p.innerHTML);

Browser Support

The following information will show you the current browser support for the Element.append() method. Hover over a browser icon to see the version that first introduced support for this method.

This method is supported by all modern browsers.

Desktop

Chrome
Edge
Firefox
Opera
Safari

Tablets & Mobile

Chrome Android
Firefox Android
Opera Android
Safari iOS
Samsung Internet
Android WebView
-
Supported Unknown Not supported
☕
Enjoying this site?

Help keep it running with a small coffee donation. Every bit of support is appreciated!

Buy us a coffee