According to method p5::select()'s reference: reference | p5.js
Searches the page for an element with the given ID, class, or tag name (using the β#β or β.β prefixes to specify an ID or class respectively, and none for a tag) and returns it as a p5.Element.
When passing a String to p5::select() w/ no β#β or β.β prefix in it, it means that String is the <tag>
's name itself.
Hereβs some online p5js sketch which I use p5::select() to get the element w/ a specified <tag>
name:
createP('Temp: '.bold() + `<temp>${weather.main.temp}</temp><deg>${F}</deg>`);
createP('Wind: '.bold() + `<wind>${weather.wind.speed}</wind><vel>${MPH}</vel>`);
temp = select('temp'), deg = select('deg');
wind = select('wind'), vel = select('vel');
I donβt think p5js got any equivalent for getElementsByName(), which searches for all elements w/ a specified name attribute!
Instead p5js got p5::selectAll(): reference | p5.js
Which can search for all elements w/ a specified <tag>
or a class attribute name:
Searches the page for elements with the given class or tag name (using the β.β prefix to specify a class and no prefix for a tag) and returns them as p5.Elements in an array.