Home › Forums › JavaScript › Book said don't use CSS IDs, use class instead but what about when Javascript? › Reply To: Book said don't use CSS IDs, use class instead but what about when Javascript?
September 9, 2014 at 11:41 am
#182364
Participant
Classes vs. IDs: I generally have very few IDs on a page, if any. About the only thing I use them for is document hashes (i.e., to be able to link to a specific item on the page). I use class names as styling hooks, and either class names or data-*
attributes as JS hooks.