HTML <select> required Attribute
Example
<label for="lang">Choose your option:</label>
<select name="language" id="lang" required>
<option value="">None</option>
<option value="HTML">HTML</option>
<option value="CSS">CSS</option>
<option value="JavaScript">JavaScript</option>
</select>
Meaning
The required attribute specifies the user will be required to select a value before submitting the form.
Standard Syntax
<select required>
<option>text</option>
</select>
Advertisement
Attribute Values
| Value | Description |
|---|---|
| required | This is a boolean attribute, the presence of a boolean attribute on an element represents the true value, and the absence of the attribute represents the false value. |