JAVASCRIPT: Avoid Using Duplicate IDs

Blue html Code BackgroundFACT: Web pages that contain duplicate IDs can cause problems in screen readers.

If two or more elements on the same page share the same ID, this can cause problems in screen readers which use IDs for labeling controls and table headings.

It can also cause problems in JavaScript methods like getElementById and querySelector, which behave inconsistently when duplicate IDs are present.

Change the IDs so all are unique for each element.


WEBSITE ACCESSIBILITY TESTING & REMEDIATION SERVICES: Mary Gillen is an experienced Website Accessibility Compliance Auditor and Remediator. She can test your website to determine if it meets accessibility standards:

WCAG 2.1: 118 checkpoints covering A, AA and AAA W3 accessibility guidelines
Section 508: 15 US federal guidelines covered by 55 accessibility checkpoints

Find out more about Mary Gillen’s Accessibility Testing & Remediation Services: Websites, PDFs, Office Docs & Videos