This page is Not Ready

Notice: The WebPlatform project, supported by various stewards between 2012 and 2015, has been discontinued. This site is now available on github.



The form attribute specifies the parent form of an html form element.

Applies to [html/elements/input](/html/elements/input)
By default, an html element related to a form is associated with it's nearest parent [form](/html/elements/form). The form attribute can be used to override or specify this. This can allow for nested forms, or inputs, buttons, etc. outside of forms, yet associated with them.

The value of the form attribute should be the id of a form that exists on the same page.


Note that a document conforming to the HTML specifications will never have nested form elements (the primary use for this attribute). However, javascript can make this situation occur.

Related specifications

W3C Candidate Recommendation

See also

Related articles