Skip to content

Node.setChildrenInPlace method

Node › setChildrenInPlace

Official

Sets the children of the node.

Signature:

setChildrenInPlace(children: Node[]): void

Parameters:

Parameter Type Description
children Node[] The children to set.

Returns: void

Example:

const parent = createEl('p');
const child1 = parent.createEl('strong', { text: '1' });
const child2 = parent.createEl('strong', { text: '2' });
const child3 = createEl('strong', { text: '3' });
parent.setChildrenInPlace([child1, child3]);
console.log(parent); // <p><strong>1</strong><strong>3</strong></p>