Sifat <button> form HTML
Definisi dan penggunaan
form
Sifat ini menentukan form milik butang.
Nilai sifat ini mesti sama dengan id sifat <form> yang sama di dokumen.
Contoh
Butang yang berada di luar form (tetapi masih bagian daripada form):
<form action="/action_page.php" method="get" id="form1"> <label for="fname">名字:</label> <input type="text" id="fname" name="fname"><br><br> <label for="lname">姓氏:</label> <input type="text" id="lname" name="lname"> </form> <button type="submit" form="form1" value="提交">提交</button>
语法
<button form="form_id">
属性值
值 | 描述 |
---|---|
form_id |
规定 <button> 元素所属的表单元素。 该属性的值必须是同一文档中 <form> 元素的 id 属性。 |
浏览器支持
Chrome | Edge | Firefox | Safari | Opera |
---|---|---|---|---|
Chrome | Edge | Firefox | Safari | Opera |
10.0 | 16.0 | 4.0 | 5.1 | 9.5 |
提示:<button> form 属性是 HTML 5 中的新属性。