HTML <button> formulář Atribut

❮ HTML tag <button>

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 formurčuje formulář, do kterého tlačítko patří.

Hodnota tohoto atributu se musí rovnat idatributu <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>