html tutorial - form Attribute in HTML - html5 - html code - html form

 form attribute in html

Learn html - html tutorial - form attribute in html- html examples - html programs

  • The form attribute specifies the element belongs to one or more forms.
  • The owner of the element will indicate the form.

Syntax for form attribute in HTML:

<element form="form_id">

Differences between HTML 4.01 and HTML5 for form attribute:

HTML 4.01

  • The form attribute does not support in HTML4.


  • HTML5 support form attribute.

Applies To:

Elements Attribute
<button> form
<fieldset> form
<input> form
<keygen> form
<label> form
<meter> form
<object> form
<output> form
<select> form
<textarea> form

Attribute Values:

Value Description
  • Defines the form element belongs to the some of the tags.
  • The value of this attribute must be the id attribute of a <form> element in the same document.
  • Sample Coding for form Attribute in HTML:

    Tryit<!DOCTYPE html>
            <title>Wikitechy form attribute</title>
            <form action="form.html" id="form_1">
            Firstname:<input type="text" name="fname"> <br>
            <input type="submit" value="Submit">
            <p>Lastname:<input type="text" name="lname" form="form_1">

    Code Explanation for form Attribute in HTML:

     form Attribute Code Explanation

    1. The <form> tag is used to define a form with input elements.
    2. Id attribute is used to define the <form> tag id as “form_1”.
    3. The form attribute is used to append the <inputt> tag to the form which has the id attribute as “form_1”.
    4. The type=”submit”is used to submit the form-data When the user click the submit button.

    Output for form Attribute in HTML:

    form Attribute Tag Output

    1. The Firstname text box is used to type a person’s first name.
    2. The submit button, is used to submit the person’s name to the form.
    3. The Lastname text box is used to type a person’s last name.
    4. form1 Attribute Tag Output

    5. When the user c <form> tag but that will be also submitted because of “form” attribute.

    Browser Support for form Attribute in HTML:

    button 10 No 4 5.1 9.5
    fieldset No No No No No
    input 9 No 4 5.1 10.6
    keygen Yes No Yes 6 Yes
    label Yes Yes Yes Yes Yes
    meter No No No No No
    object No No No No No
    output Yes Yes Yes Yes Yes
    select Yes No Yes Yes Yes
    textarea Yes No Yes Yes Yes

    Related Searches to form Attribute in html

    Adblocker detected! Please consider reading this notice.

    We've detected that you are using AdBlock Plus or some other adblocking software which is preventing the page from fully loading.

    We don't have any banner, Flash, animation, obnoxious sound, or popup ad. We do not implement these annoying types of ads!

    We need money to operate the site, and almost all of it comes from our online advertising.

    Please add to your ad blocking whitelist or disable your adblocking software.