HTML5 <form> Tag


A simple HTML form with two input fields and one submit button:

<form action="form_action.html">
First name: <input type="text" name="fname" value="Guru" /><br />
Last name:<input type="text" name="lname" value="Dharsan" /><br />
<input type="submit" value="Submit" />

Definition and Usage

The form element creates a form for user input.

The form element contains one or more form elements: button, input, keygen, object, output, select, and textarea.

Forms are used to pass user-data to a server.

Differences Between HTML 4.01 and HTML5

HTML5 has some new attributes, and some HTML 4.01 attributes are not supported in HTML5.


Attribute Value Description
accept MIME_type Not supported in HTML5
accept-charset charset_list A comma separated list of possible character sets for the form data
action URL A URL that defines where to send the data when the submit button is pushed
autocomplete on
If "on" browsers can store the form's input values, to auto-fill the form if the user returns to the page.
If "off" browsers should not store this information
enctype application/x-www-form-urlencoded
The mime type used to encode Content of the form
method get
The HTTP method for sending data to the action URL. Default is get
name form_name Defines a unique name for the form
novalidate novalidate If present the form should not be validated when submitted
target _blank
Where to open the target URL

Standard Attributes

The <form> tag also supports the Standard Attributes in HTML5.

Event Attributes

The <form> tag also supports the Event Attributes in HTML5.

Have Any Suggestion? We Are Waiting To Hear from YOU!

Your Query was successfully sent!