Can I have a Class and an ID?

Dumb question… (Hey, it’s late?!)

Can I have both a Class and an ID in one Input? :-/

<input type=“submit” name=“submit” class=“button” id=“submit” value=“Add a comment” />



You can have one id and as many classes as you like on any one element. It might break in some browsers if a class or id has the same name as a tag or attribute though.

did it work when you tried it?

In any case, it’s not a good idea to have class or id values the same as html element types.