20. What does the required attribute do?

The required attribute indicates that a form control must have a value before the browser allows normal form submission. It provides native client-side validation.

Key Takeaways
  • required enables native mandatory-field validation.
  • Server-side validation is still necessary.
Knowledge Check

What does required do?