HTML <wybierz> formularz Atrybut

❮ Tag HTML5 <select>

Przykład

Lista rozwijana znajdująca się poza formularzem (ale nadal stanowiąca część formularza):

<form action="/action_page.php" id="carform">
  <label for="fname">Firstname:</label>
  <input type="text" id="fname" name="fname">
  <input type="submit">
</form>

<label for="cars">Choose a car:</label>
<select name="cars" id="cars" form="carform">
  <option value="volvo">Volvo</option>
  <option value="saab">Saab</option>
  <option value="opel">Opel</option>
  <option value="audi">Audi</option>
</select>

Definicja i użycie

Atrybut określa formularz, do formktórego należy lista rozwijana.

Wartość tego atrybutu musi być równa idatrybutowi <form> elementu w tym samym dokumencie.


Obsługa przeglądarki

Attribute
form Yes Yes Yes Yes Yes

Składnia

<select form="form_id">

Wartości atrybutów

Value Description
form_id Specifies the form element the <select> element belongs to. The value of this attribute must be equal to the id attribute of a <form> element in the same document.

❮ Znacznik HTML <select>