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

JS can do just as well with unique classnames, which avoids issues with ids like those given in the article.
I always presumed this would usually entail a performance hit, since you are accessing something that is not defined as unique.
It's an infinitesimal performance decrease, and it avoids a lot of other issues.