HTML <button> form Attribute

The form attribute on a <button> tag specifies the form the button is associated with. The form attribute requires that the <button> is of type submit.

Example

#

A form attribute on a submit <button>.
Although outside the form, this button can submit the form above it.

Address Information





<form action="/tutorial/action.html" id="address-form">
 <fieldset>
  <legend>Address Information</legend>
  <input type="text" name="street" placeholder="Street"><br /><br />
  <input type="text" name="city" placeholder="City"><br /><br />
  <input type="text" name="country" placeholder="Country"><br /><br />
 </fieldset>
</form> 

<button form="address-form" 
        type="submit" >Submit</button>

Using form

The form attribute specifies the form the button is associated with.

The attribute value is the id of the form.

Once associated to a form, the button can submit that form.


Syntax

<button form="form-id">

Values

#

Value Description
form-id The id value of the form.

Browser support

Here is when form support started for each browser:

Chrome
10.0 Mar 2011
Firefox
4.0 Mar 2011
IE/Edge
16.0 Apr 2017
Opera
9.5 Jun 2008
Safari
5.1 Oct 2011

You may also like

 Back to <button>
Guides