HTML & CSS · Junior · Question 45 of 75
What does the required attribute do on a form field?
- ✓Correct answer: The browser won't submit the form while the field is empty
- 2The field becomes read-only until the form is submitted
- 3The field value is automatically validated on the server
Explanation
required enables built-in client-side validation: with an empty field, submit is blocked and the field matches :invalid. Read-only is readonly. Client-side validation is just a convenience: it's easy to bypass, so the server must validate data itself.