Skip to content

Node.appendText method

Node › appendText

Official

Appends a text node to the node.

Signature:

appendText(val: string): void

Parameters:

Parameter Type Description
val string The text to append.

Returns: void

Example:

const parent = createEl('p');
parent.createEl('strong', { text: 'foo' });
parent.appendText('bar');
console.log(parent); // <p><strong>foo</strong>bar</p>