Skip to content

Window.fishAll method

Window › fishAll

Official

Finds all elements that match the selector.

Signature:

fishAll(selector: string): HTMLElement[]

Parameters:

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

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

Example:

const 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')); // []