HTML button form Property
Examples
Located outside of the form submit button (but still forms part of):
<form action="demo-form.php" method="get" id="nameform">
First name: <input type="text" name="fname" /><br>
Last name: <input type="text" name="lname" /><br>
</form>
<p>下面的按钮是在表单元素外,但仍是表单的一部分。</p>
<button type="submit" form="nameform" value="提交">提交</button>
First name: <input type="text" name="fname" /><br>
Last name: <input type="text" name="lname" /><br>
</form>
<p>下面的按钮是在表单元素外,但仍是表单的一部分。</p>
<button type="submit" form="nameform" value="提交">提交</button>
try it"
Browser Support
In addition to the Internet Explorer browser, the other major browsers support form property.
Definition and Usage
form attribute specifies buttons belong to one or more forms.
Differences between HTML 4.01 and HTML5
HTML5 form attribute is the new property.
grammar
<button form=" form_id ">
Property Value
value | description |
---|---|
form_id | id button belongs to the form. To quote more than one form, use a space-separated list. |
HTML <button> tag