pub static select: SelectInternalTypeExpand description
Searches the page for the first element that matches the given CSS selector string (can be an ID, class, tag name or a combination) and returns it as a p5.Element. The DOM node itself can be accessed with .elt. Returns null if none found. You can also specify a container to search within.
Examples
function setup() {
createCanvas(50, 50);
background(30);
// move canvas down and right
select('canvas').position(10, 30);
}// select using ID
let a = select('#container');
let b = select('#beep', '#container');
let c;
if (a) {
// select using class
c = select('.boop', a);
}
// select using CSS selector string
let d = select('#container #bleep');
let e = select('#container p');
[a, b, c, d, e]; // unusedParameters
selectors CSS selector string of element to search for
container? CSS selector string, p5.Element, or
HTML element to search within