Interview Question

What is required attribute?

Required prevents an empty form field from being submitted.

💡 Concept ✅ Quick Revision 🌐 HTML

Answer

The `required` attribute tells the browser that a form field must be completed. β€’ It is written inside an element’s opening tag. β€’ The HTML Standard limits which elements may use it and which values are valid. β€’ Browsers apply the attribute when they process the element or the resource it controls.

💡 Simple Example

<input type="email" required>

⚡ Quick Revision

Required prevents an empty form field from being submitted.