HTML <button> form Atribut
Contoh
Tombol yang terletak di luar formulir (tetapi masih merupakan bagian dari formulir):
<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>
Definisi dan Penggunaan
Atribut form
menentukan bentuk tombol milik.
Nilai atribut ini harus sama dengan id
atribut
<form>
elemen dalam dokumen yang sama.
Dukungan Peramban
Angka-angka dalam tabel menentukan versi browser pertama yang sepenuhnya mendukung atribut tersebut.
Attribute | |||||
---|---|---|---|---|---|
form | 10.0 | 16.0 | 4.0 | 5.1 | 9.5 |
Sintaksis
<button form="form_id">
Nilai 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. |
tag <button> HTML