HTML <button> formulář Atribut
Příklad
Tlačítko umístěné mimo formulář (ale stále součástí formuláře):
<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>
Definice a použití
Atribut form
určuje formulář, do kterého tlačítko patří.
Hodnota tohoto atributu se musí rovnat id
atributu
<form>
prvku ve stejném dokumentu.
Podpora prohlížeče
Čísla v tabulce určují první verzi prohlížeče, která tento atribut plně podporuje.
Attribute | |||||
---|---|---|---|---|---|
form | 10.0 | 16.0 | 4.0 | 5.1 | 9.5 |
Syntax
<button form="form_id">
Hodnoty atributů
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. |
❮ HTML tag <button>