Skip to content

createDiv

Creates a <div> and appends it to this node, as createEl does.

Import:

import 'obsidian-test-mocks/setup';

Signature:

function createDiv(this: Node, o: string | DomElementInfo | undefined, callback: ((el: HTMLDivElement) => void) | undefined): HTMLDivElement

Parameters:

Parameter Type Description
this Node
o string | DomElementInfo | undefined A class name, or the element’s options; the parent is always this node.
callback ((el: HTMLDivElement) => void) | undefined Called with the new element before it is returned.

Returns: HTMLDivElement — The new \<div\>.