Y
Hacker News
new
|
ask
|
show
|
jobs
by
goatlover
1358 days ago
Use ids when JS needs to reference unique elements. Use classes for styling and accessing groups.
1 comments
isleyaardvark
1358 days ago
JS can do just as well with unique classnames, which avoids issues with ids like those given in the article.
link
sgc
1358 days ago
I always presumed this would usually entail a performance hit, since you are accessing something that is not defined as unique.
link
isleyaardvark
1356 days ago
It's an infinitesimal performance decrease, and it avoids a lot of other issues.
link