Function: write()
Overload 1
write(
element,text):void
Defined in: dom.ts:92
Sets the text content of the given element.
Parameters
element
HTMLElement
The target element.
text
string
The text to write.
Returns
void
Example
ts
// HTML
<p id="message"></p>
// JS
const el = facile.getElement('#message');
facile.write(el, 'Hello!');Overload 2
write<
K>(tag,text):void
Defined in: dom.ts:105
Sets the text content of 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.
text
string
The text to write.
Returns
void
Example
ts
// HTML
<p></p>
// JS
facile.write('p', 'Hello!');Overload 3
write(
selector,text):void
Defined in: dom.ts:118
Sets the text content of the first element matching the given CSS selector. Does nothing if no element is found.
Parameters
selector
string
A CSS selector string.
text
string
The text to write.
Returns
void
Example
ts
// HTML
<p id="message"></p>
// JS
facile.write('#message', 'Hello!');