Skip to content

create

create<K>(tag, attrs?): HTMLElementTagNameMap[K]

Defined in: core/dom/elements.ts:33

Creates an element with attributes.

K extends keyof HTMLElementTagNameMap

K

Tag name, e.g. div.

ElementAttrs

Attributes to set. Use the key class for the class name.

HTMLElementTagNameMap[K]

const div = create('div', { id: 'test-elem', class: 'cool-div' });

create(tag, attrs?): HTMLElement

Defined in: core/dom/elements.ts:34

Creates an element with attributes.

string

Tag name, e.g. div.

ElementAttrs

Attributes to set. Use the key class for the class name.

HTMLElement

const div = create('div', { id: 'test-elem', class: 'cool-div' });