I have a lot of very similar HTML elements I need to import into my JavaScript file but the normal way would just look so drab and it would be way too cumbersome, anyone know a way to import these elements with a single command, or is it even possible?
I need a vanilla JS solution.
By import I mean document.getElementById("example");
and attatching it to a variable.
<div id="graph-points-x">
<div id="p0">0</div>
<div id="x1">1</div>
<div id="x2">2</div>
<div id="x3">3</div>
<div id="x4">4</div>
<div id="x5">5</div>
<div id="x6">6</div>
<div id="x7">7</div>
<div id="x8">8</div>
<div id="x9">9</div>
</div>
<div id="graph-points-y">
<div id="y1">1</div>
<div id="y2">2</div>
<div id="y3">3</div>
<div id="y4">4</div>
<div id="y5">5</div>
<div id="y6">6</div>
<div id="y7">7</div>
<div id="y8">8</div>
<div id="y9">9</div>
</div>