HTML-<button > -Formularattribut

❮ HTML <button>-Tag

Beispiel

Eine Schaltfläche außerhalb eines Formulars (aber immer noch Teil des Formulars):

<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>

Definition und Verwendung

Das formAttribut gibt das Formular an, zu dem die Schaltfläche gehört.

Der Wert dieses Attributs muss gleich dem idAttribut eines <form> Elements im selben Dokument sein.


Browser-Unterstützung

Die Zahlen in der Tabelle geben die erste Browserversion an, die das Attribut vollständig unterstützt.

Attribute
form 10.0 16.0 4.0 5.1 9.5

Syntax

<button form="form_id">

Attributwerte

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 <button>-Tag