Dofactory.com
Dofactory.com
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 freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

HTML <input> form Attribute

The form attribute on an <input> tag specifies the form the input element is associated with.

The input element will be included during the form submission.

Example

#

An <input> field with a form attribute. Although outside the form, this input field is included during form submission.

Personal Information


<form action="/tutorial/action.html" id="myform">
  <fieldset style="background: #f6f8ff; border: 2px solid #4238ca;">
    <legend>Personal Information</legend>
    <input type="text" name="firstname" placeholder="First name">

    <br /><br />
    <input type="submit" value="Submit">
  </fieldset>
</form> <br />

<input form="myform" type="text" name="lastname" placeholder="Last name">

Using form

The form attribute specifies the form the input element is associated with.

The attribute value is the id of the form.

Once associated with a form, the input element is included during form submission.


Syntax

<input form="form-id">

Values

#

Value Description
form-id The id of a form element.

Browser support

Here is when form support started for each browser:

Chrome
1.0 Sep 2008
Firefox
1.0 Sep 2002
IE/Edge
1.0 Aug 1995
Opera
10.6 Jul 2010
Safari
5.1 Oct 2011

You may also like

 Back to <input>

Last updated on Sep 30, 2023

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 freelancing marketplace for people like you.
By adding your name & email you agree to our terms, privacy and cookie policies.

Guides