1. The Element & Accessibility
Every form input must be paired with a . To bind a label to an input, match the label's for attribute with the input's id attribute:
- Clicking the label automatically focuses the associated text input or toggles the checkbox.
- Screen readers announce the label text when the student tabs through inputs.
2. placeholder vs label
A placeholder provides a short hint of the expected format (e.g., placeholder="DD/MM/YYYY"). Never use placeholders as substitutes for labels, because placeholders disappear as soon as the user starts typing.
3. Enforcing Inputs with required
Adding the boolean required attribute prevents form submission if the field is left blank, displaying a native browser validation tooltip.