What is the class attribute for? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the class attribute for?

17th Aug 2019, 6:53 PM
Ire Adeoluwa
3 Answers
+ 3
I think it offers a way to group some elements. And then you can easily manipulate those groups using the class name by CSS and JS. When DOM is mainly used to search elements by one of 3 different attributes: name id class Where name reference to the tag name, id reference to identifier, (not 2 elements should have the same identifier, this allows to easily find single elements), and class reference to a group, to easily reference to multiple, otherwise independent elements. It should all get clear for you in CSS tutorial and JS tutorial's DOM part.
17th Aug 2019, 8:14 PM
Seb TheS
Seb TheS - avatar
+ 2
Koder King does that link really answer the question?
17th Aug 2019, 8:16 PM
Seb TheS
Seb TheS - avatar
0
yeah Seb TheS is right, put some effort into it Koder King , no one wants to see your shitty no effort answers. Author asks for class attribute not attributes in general. Edit: thanks for deleting it
17th Aug 2019, 8:26 PM
Ole113
Ole113 - avatar