Formularz HTML <button> Atrybut
Przykład
Przycisk znajdujący się poza formularzem (ale nadal częścią formularza):
<form action="/action_page.php" method="get" id="form1">
<label for="fname">First
name:</label>
<input type="text" id="fname" name="fname"><br><br>
<label for="lname">Last name:</label>
<input type="text" id="lname"
name="lname">
</form>
<button type="submit" form="form1"
value="Submit">Submit</button>
Definicja i użycie
Atrybut określa formę, do form
której należy przycisk.
Wartość tego atrybutu musi być równa id
atrybutowi
<form>
elementu w tym samym dokumencie.
Obsługa przeglądarki
Liczby w tabeli określają pierwszą wersję przeglądarki, która w pełni obsługuje ten atrybut.
Attribute | |||||
---|---|---|---|---|---|
form | 10.0 | 16.0 | 4.0 | 5.1 | 9.5 |
Składnia
<button form="form_id">
Wartości atrybutów
Value | Description |
---|---|
form_id | Specifies the form element the <button> element belongs to. The value of this attribute must be the id attribute of a <form> element in the same document. |
❮ Znacznik HTML <button>