create
Call Signature
Section titled “Call Signature”create<
K>(tag,attrs?):HTMLElementTagNameMap[K]
Defined in: core/dom/elements.ts:33
Creates an element with attributes.
Type Parameters
Section titled “Type Parameters”K extends keyof HTMLElementTagNameMap
Parameters
Section titled “Parameters”K
Tag name, e.g. div.
attrs?
Section titled “attrs?”Attributes to set. Use the key class for the class name.
Returns
Section titled “Returns”HTMLElementTagNameMap[K]
Example
Section titled “Example”const div = create('div', { id: 'test-elem', class: 'cool-div' });Call Signature
Section titled “Call Signature”create(
tag,attrs?):HTMLElement
Defined in: core/dom/elements.ts:34
Creates an element with attributes.
Parameters
Section titled “Parameters”string
Tag name, e.g. div.
attrs?
Section titled “attrs?”Attributes to set. Use the key class for the class name.
Returns
Section titled “Returns”HTMLElement
Example
Section titled “Example”const div = create('div', { id: 'test-elem', class: 'cool-div' });