- Prevent content reproduction errors and interaction errors via scripts.
- Limit the risk of random interpretation of the Document Object Model (DOM) by different user agents.
- Improve the accessibility of content for people with disabilities.
The most drastic solution is to ensure the complete validity of the source code of the pages, using a validator such as http://validator.w3.org. However, this solution leads to taking account of all the source code validation errors which do not fall within the scope of this best practice. To keep to the scope of this best practice, take care to avoid any duplicate value of an
id attribute in the same HTML page.
Find out more:
Submit the page to the W3C HTML validator (validator.w3.org) or other code validation tool and verify that each
id attribute value is unique within the page.
By Opquast - Read the license