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

HTML Referenzhandbuch

Vollständiges Verzeichnis der HTML-Tags

HTML select required Eigenschaft

Die select required-Eigenschaft ist eine boolesche Eigenschaft, die angibt, dass der Benutzer vor dem Absenden des Formulars einen Wert auswählen muss.

 HTML <select> Tag

Online-Beispiel

HTML-Formular mit einer obligatorischen Auswahlbox:

<form action="action_page.php">
<select name="lan" required>
  <option value="PHP">PHP</option>
  <option value="Python">Python</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 new attributes.

Differences between HTML and XHTML

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

Syntax

<select required>
 HTML <select> Tag