Skip to content

Element.findAll method

Element › findAll

Official

Finds all descendant elements that match the selector.

Signature:

findAll(selector: string): Element[]

Parameters:

Parameter Type Description
selector string The selector to find the elements with.

Returns: Element[]An array of all descendant elements that match the selector.

Remarks:

See bug https://forum.obsidian.md/t/bug-find-findall-findallself/98108.

Example:

const element = createEl('p');
element.createEl('strong', { cls: 'foo' });
element.createEl('strong', { cls: 'foo' });
console.log(element.findAll('.foo')); // [<strong class="foo"></strong>, <strong class="foo"></strong>]
console.log(element.findAll('.bar')); // []