Can does html document include id with same name more that one? To which element does the function refer in that case? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 7

Can does html document include id with same name more that one? To which element does the function refer in that case?

I know about classes.

10th Mar 2017, 8:10 PM
Андрей Екатеренчук
Андрей Екатеренчук - avatar
8 Answers
+ 8
@Karel: um... how many ids do you have? I only have one id card to identify myself. it's the same for tags. it won't be valid html if they had multiple ids.
11th Mar 2017, 9:42 AM
Mario L.
Mario L. - avatar
+ 6
Point blank straight.... This question has the right answer by Mario Laurisch. There's a reason for classes.
11th Mar 2017, 4:46 PM
Mark Foxx
Mark Foxx - avatar
+ 5
there can be multiple ids in a html document, but all of them must be unique and every tag may only have one id.
10th Mar 2017, 8:21 PM
Mario L.
Mario L. - avatar
+ 5
I expanded the question.
11th Mar 2017, 2:09 AM
Андрей Екатеренчук
Андрей Екатеренчук - avatar
+ 5
@Mario, if P tag has id that is same DIV's id?
11th Mar 2017, 10:13 AM
Андрей Екатеренчук
Андрей Екатеренчук - avatar
11th Mar 2017, 5:10 PM
Андрей Екатеренчук
Андрей Екатеренчук - avatar
0
I'm going to try multiple id per a tag. I don't see why this can't be possible.
10th Mar 2017, 9:31 PM
Karel Vlcek
Karel Vlcek - avatar
0
@Mario well, you are right. Accidentaly, I was just thinking about some trick in an environment where I can't use php nor sql ( my job is not IT).
12th Mar 2017, 3:39 PM
Karel Vlcek
Karel Vlcek - avatar