Hacker News
new
|
past
|
comments
|
ask
|
show
|
jobs
|
submit
login
goatlover
on Sept 27, 2022
|
parent
|
context
|
favorite
| on:
Named element IDs can be referenced as JavaScript ...
Use ids when JS needs to reference unique elements. Use classes for styling and accessing groups.
isleyaardvark
on Sept 27, 2022
[–]
JS can do just as well with unique classnames, which avoids issues with ids like those given in the article.
sgc
on Sept 28, 2022
|
parent
[–]
I always presumed this would usually entail a performance hit, since you are accessing something that is not defined as unique.
isleyaardvark
on Sept 29, 2022
|
root
|
parent
[–]
It's an infinitesimal performance decrease, and it avoids a lot of other issues.
Guidelines
|
FAQ
|
Lists
|
API
|
Security
|
Legal
|
Apply to YC
|
Contact
Search: