1. 19
    Avoid Duplicate id Attributes when Reusing Form Components
    2m 43s

Avoid Duplicate id Attributes when Reusing Form Components

InstructorAndy Van Slaars

Share this video with your friends

Send Tweet

When we reuse components that rely on HTML id attributes, we run the risk of rendering HTML that results in duplicate IDs in the HTML. IDs are meant to be unique and this is problematic when rendering multiple forms, where IDs are used to make the association between labels and inputs. If this association is broken, it leads to unexpected behavior and is an accessibility issue. In this lesson, we'll look at how we can conditionally assign IDs and ensure that we don't render duplicate IDs, even when rendering several instances of the same form component on the page.