createDiv
Official
Creates a new <div> element.
Signature:
function createDiv(o?: DomElementInfo | string, callback?: (el: HTMLDivElement) => void): HTMLDivElementParameters:
| Parameter | Type | Description |
|---|---|---|
o? |
DomElementInfo | string | The options object. |
callback? |
(el: HTMLDivElement) => void | 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' });});Links to this page: