HTML <form> tag
HTML <form> tag
The <form>
tag is used to create an HTML form for user input.
The <form>
element does not actually create form fields, but is used as a parent container to hold the following form elements:
Example
HTML Online Editor
<!DOCTYPE html>
<html>
<body>
<form action="/user-name.php">
Name: <input type="text" name="name">
<button type="submit">Submit</button>
</form>
</body>
</html>
Attributes
The following are the attributes of <form> tag. Also try Global attributes.
Attribute | Value | Explanation |
---|---|---|
accept-charset | character_set | Specifies the character encodings that the server accepts. |
action | URL | Specifies where to send a form data when the user clicks on the submit button. |
autocomplete |
| Specifies whether the value of the <input> elements in the form can be automatically completed by the browser. |
enctype |
| Specifies how to encode a form-data before sending it to a server. |
method |
| Specifies the HTTP method that the browser uses to submit the form. |
name | text | Specifies a name for the form. |
novalidate | - | Specifies the form should not be validated when the user clicks on the submit button. |
target |
| Specifies where to display the response after submitting the form. |
Deprecated Attributes
The following attributes should not be used in any case.
Attribute | Value | Explanation |
---|---|---|
accept | file_type | Specifies a comma-separated list of file types that the server accepts. |
autocapitalize |
| Specifies a user typed value should be auto capitalized as per its attribute value. |
Reminder
Hi Developers, we almost covered 99.5% of HTML Tutorials with examples for quick and easy learning.
We are working to cover every Single Concept in HTML.
Please do google search for:
Join Our Channel
Join our telegram channel to get an instant update on depreciation and new features on HTML, CSS, JavaScript, jQuery, Node.js, PHP and Python.
This channel is primarily useful for Full Stack Web Developer.