Skip to content

fishAll

Official

Finds all elements that match the selector.

Example:

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

Signature:

function fishAll(selector: string): HTMLElement[]

Parameters:

ParameterTypeDescription
selectorstringThe selector to find the elements with.

Returns: HTMLElement[] — An array of all elements that match the selector.

Example:

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