ID attribute value must be unique
Updated over a week ago

IDs within html elements can be used as anchors for navigating through content. IDs can also be utilized to trigger javascript actions. IDs are intended to be unique elements where a specific ID is only used within a single web page once.

Utilizing the same ID more than once on a page can cause confusion and unexpected behavior if that ID is referenced by an internal link within the page or a javascript that is suppose to trigger an action. Users may be taken randomly to the one area of the page when the intent was the second area with that ID.

Aria-labelledby also allows users to specify an ID within a page for applying labels to elements of a page. If aria-labelledby references an ID that is included in the webpage more than once, the resulting label may not be the intended label because it will be up to the browser on which one is used to populate the label.

Did this answer your question?