Reference select()

select()

Searches the page for the first element that matches the given CSS selector string.

The selector string can be an ID, class, tag name, or a combination. select() returns a p5.Element object if it finds a match and null if not.

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

select(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|null: p5.Element containing the element.
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