Skip to content

Function: emptyDom() ​

ts
function emptyDom(el): void;

Removes all child nodes from the specified DOM element.

Parameters ​

ParameterTypeDescription
elHTMLElementThe DOM element to empty.

Returns ​

void

Example ​

ts
const el = document.createElement('div')
el.textContent = 'hello'
emptyDom(el)
el.textContent // => ''

Since ​

1.0.0

Released under the MIT License.