I have several links to play videos in a player with javascript. What would be the best way to refer to the id of the player from the link to make these links accessible and syntactically correct? It would be similar to using the for attribute in a label element.
<a href="video" rel="playerid">video</a>
<a href="video" data-playerid="playerid">video</a>
<a href="video" itemref="playerid">video</a>
Your second one, using the
data-*attribute:I don’t believe your first example using
relworks if the player ID varies, because although you can add to the list of valid values (thank you for pointing that out!), therelstill expresses the kind of relationship (e.g.,rel="icon"orrel="canonical"), not the ID of something (which is the URI in thehref).Your third one uses a custom attribute without a
data-prefix, making the HTML invalid.So I think the second one, the
data-*, is the way to go.