replaceChildren

The replaceChildren JS ParentNode replaces all the children of the node with nodes, while replacing the strings in the nodes with equivalent text nodes.

Syntax

node.replaceChildren(nodes)

Parameters

nodes

Objects that implement Node. Nodes participate in a tree, which is known as the node tree.

Examples

1

2

3

4

append

children

firstElementChild

lastElementChild

prepend

querySelector

querySelectorAll

Web Hypertext Application Technology Working Group (WHATWG)

Home Menu