Reference selectAll()

selectAll()

Searches the page for all elements that matches the given CSS selector string.

The selector string can be an ID, class, tag name, or a combination. selectAll() returns an array of p5.Element objects if it finds any matches and an empty array if none are found.

The second parameter, container, is optional. It specifies a container to search within. container can be CSS selector string, a p5.Element object, or an HTMLElement object.

Examples

Syntax

selectAll(selectors, [container])

Parameters

selectors
String:

CSS selector string of element to search for.

container
String|p5.Element|HTMLElement:

CSS selector string, p5.Element, or HTMLElement to search within.

Returns

p5.Element[]: array of p5.Elements containing any elements found.
Notice any errors or typos? Please let us know. Please feel free to edit src/dom/dom.js and open a pull request!

Related References