required

The required boolean attribute forces a form control to have a value before the form can be submitted.

Since HTML5 Spec ↗

Syntax

required

Examples

<input type="email" name="email" required>
<button type="submit">Sign up</button>
Output
Blocks submission and shows a native validation message if the email field is empty or invalid.

Notes

A boolean attribute that triggers the :required pseudo-class and constraint validation. Pair with a visible label and an accessible error message; do not rely on the native bubble alone.

Browser & runtime support

EnvironmentSince version
chrome 5.0
firefox 4.0
safari 10.1
edge 12

See also