HTML & CSS · Junior · Question 45 of 75

What does the required attribute do on a form field?

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.

Further reading

Problem with a question

HTML & CSS · Junior · question 45

Test yourself

Take the HTML & CSS · Junior quiz: questions and options are shuffled, and you get a review of your mistakes at the end.

Take this quiz