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