forattribuutin
The for attribute is an HTML attribute used on label elements to bind a text label to a form control by specifying the id of that control. When the for attribute references the id of an input, select, textarea, or other form element, clicking the label focuses that control and assistive technologies can associate the two elements, improving form accessibility.
Example: <label for="email">Email</label> <input type="email" id="email" name="email" />. The value of the for attribute must exactly match
If the input element is placed inside the label element, the association can be implicit and the
Compatibility and accessibility: The for attribute is supported in HTML5 and across all major browsers. It
Best practices: Use descriptive, stable ids and corresponding label text, keep labels concise, and place the