DOM Element.append() Method
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
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.
Desktop





Tablets & Mobile





