Window.createDiv method
Window › createDiv
Official
Creates a new<div> element. Signature:
createDiv(o?: string | DomElementInfo | undefined, callback?: ((el: HTMLDivElement) => void) | undefined): HTMLDivElementParameters:
| Parameter | Type | Description |
|---|---|---|
| o? | string | DomElementInfo | undefined | The options object. |
| callback? | ((el: HTMLDivElement) => void) | undefined | A callback function to be called when the element is created. |
Returns: HTMLDivElement — The created element.
Example:
createDiv({ text: 'foo' }, (div) => { div.createEl('strong', { text: 'bar' });});