Diffrences between id, class, and name?

What is the difference between id, class, and name? I have been struggling with which one to use… and if possible can you tell me when I might use these attributes?

this one is for your question

1 Like

so to summarize it…

  1. I will use class when i have multiple elements
  2. use id when u have only 1 element
  3. name is sort of like a group for input type

Yeah, that’s basically it. Remember that id must be unique - you only use it for one element. For class you can have as many as you want. I think of name as a grouping thing for forms, like telling it that a group of radio buttons are all related to a certain property. (But there may be more to it, I don’t do vanilla forms much.)

1 Like

This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.