Function: empty()
Overload 1
empty(
element):void
Defined in: dom.ts:441
Removes all child nodes from the given element.
Parameters
element
HTMLElement
The target element.
Returns
void
Example
ts
// HTML
<div id="container"><p>Hello!</p></div>
// JS
const el = facile.getElement('#container');
facile.empty(el);Overload 2
empty<
K>(tag):void
Defined in: dom.ts:453
Removes all child nodes from the first element matching the given tag name. Does nothing if no element is found.
Type Parameters
K
K extends keyof HTMLElementTagNameMap
Parameters
tag
K
The HTML tag name to search for.
Returns
void
Example
ts
// HTML
<div><p>Hello!</p></div>
// JS
facile.empty('div');Overload 3
empty(
selector):void
Defined in: dom.ts:465
Removes all child nodes from the first element matching the given CSS selector. Does nothing if no element is found.
Parameters
selector
string
A CSS selector string.
Returns
void
Example
ts
// HTML
<div id="container"><p>Hello!</p></div>
// JS
facile.empty('#container');