HTML <select> required attribute
Definition and Usage
required
Attribute is a boolean attribute.
When present, it specifies that the user must select a value before submitting the form.
Example
An HTML form with a required dropdown list:
<label for="cars">Please select a car brand:</label> <select name="cars" id="cars" required> <option value="">None</option> <option value="volvo">Volvo</option> <option value="saab">Saab</option> <option value="mercedes">Mercedes</option> <option value="audi">Audi</option> </select>
Syntax
<select required>
Browser Support
The numbers in the table indicate the first browser version to fully support this property.
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
Support | 10.0 | 4.0 | Support | Support |