Hacker News new | ask | show | jobs
by leeoniya 1666 days ago
yep. and please dont query the dom 100k times, or in a loop :)
1 comments

also with querySelector you can use queries like

> ids.map(id=> `#test${id}`).join(" , ")

or

> `[id^="test"]`

to get all elements that have an id that starts with test

Thus opening up a whole swarm of potential bugs, you should probably just use a class if you need to reference a list of elements when possible.
well at that point it would be wise not to use ids for queries, but the logic remains the same.