Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

yep. and please dont query the dom 100k times, or in a loop :)


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.




Consider applying for YC's Summer 2026 batch! Applications are open till May 4

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: