+ 1
What is the main difference between id and class attribute?
4 Answers
+ 1
It can be more than one element with the same class, but you can only have one element per id
+ 1
ID is for an individual element.
CLASS is something you can place on multiple elements, and they'll all be affected by the class definition.
With that being said, you can have an element that has an ID set, and then is part of multiple classes. You can call that individual element by its ID, or you can refer to all elements of a class by using its CLASS name.
+ 1
@Netkos Ent
How about document.all("id of htmlelement")?
document.all select multiple elements which have same id attribute
+ 1
Sorry, didn't notice reply until now. You can manipulate the elements in that manner, but that approach is why we created classes, as I'm sure you can figure out the implications that come along with going about it that way.