English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية

HTML Reference Manual

HTML Tag Directory

HTML select required attribute

The select required attribute is a boolean attribute that specifies that a value must be selected before the form can be submitted.

 HTML <select> tag

Online Example

HTML form with a required dropdown list:

<form action="action_page.php">
<select name="lan" required>
  <option value="PHP">PHP</option>/option>
  <option value="Python">Python</option>/option>
  <option value="C#">C#</option>
  <option value="Golang">Golang</option>
</select>
<input type="submit">
</form>
Test and see ‹/›

Browser Compatibility

IEFirefoxOperaChromeSafari

Almost all mainstream browsers do not support the required attribute.

Definition and Usage

The required attribute is a boolean attribute.

The required attribute specifies that a user must select a value before submitting the form.

HTML 4.01 with HTML5differences

The required attribute is in HTML5 with the newly added attributes.

Differences between HTML and XHTML

In XHTML, attribute abbreviations are prohibited, the required attribute must be defined as <select required="required" />。

Syntax

<select required>
 HTML <select> tag