Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest self-service freelancing marketplace for people like you.

HTML <button> form Attribute

The form attribute on a <button> tag specifies the form the button will submit.

The form attribute requires that the <button> is of type submit.

Example

#

A submit <button> with a form attribute. Although outside the form, this button does 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>
Earn income with your HTML skills
Sign up and we'll send you the best freelance opportunities straight to your inbox.
We're building the largest self-service freelancing marketplace for people like you.

Guides