Look Through Results From querySelectorAll In JavaScript
January 2025
const els = document.;
.;or
// NOTE: This one needs to be tested once
// I get my site pages working again
const els = document.;
.;Notes
-
.returns a static NodeList - Because it's a static list, changing the DOM to add or remove elements that match the query won't effect the results
-
NodeLists can be looped over with
. -
You can check a NodeList's length with
. -
NodeLists aren't an array so you can't do a regular
forloop on them without converting them to an array. -
You can convert them to an array with
Array.
end of line