Window.createEl method
Window › createEl
Official
Creates a new element.Signature:
createEl(tag: K, o?: string | DomElementInfo | undefined, callback?: ((el: HTMLElementTagNameMap[K]) => void) | undefined): HTMLElementTagNameMap[K]Parameters:
| Parameter | Type | Description |
|---|---|---|
| tag | K | The tag name of the element to create. |
| o? | string | DomElementInfo | undefined | The options object. |
| callback? | ((el: HTMLElementTagNameMap[K]) => void) | undefined | A callback function to be called when the element is created. |
Returns: HTMLElementTagNameMap[K] — The created element.
Example:
createEl('p', { text: 'foo' }, (p) => { p.createEl('strong', { text: 'bar' });});