HTML <form> Tag
In this tutorial, we will learn about footer tag in HTML with the help of examples.
<form> Tag
Form tag <form> is used to create a form for user input.
Some of the form tags(tags we can use inside the form tag) are :
<input>, <textarea>, <button>, <option>, <select>, <optgroup>, <fieldset>, <label>, <output> tag.
Syntax
<form>.......</form>
Example
<!DOCTYPE html>
<html>
<head>
<title>Form Tag</title>
</head>
<body>
<form>
First name :
<input type = "text" value = "" maxlength = "50"><br>
Last name :
<input type = "text" value = "" maxlength = "50"><br>
<button type = "submit">Submit</button>
</form>
</body>
</html>
Output
Specific Attribute
Attribute | Value | Description |
---|---|---|
accept | MIME-type | Specifies a comma-seperated list of content types that server accepts |
accept-charset | charset list | Specifies a list of character encodings that the server accepts |
action | URL | Specifies a URI/URL of the back-end script that will process the form |
autocomplete | on off |
Specifies whether the form should have autocomplete on or off |
enctype | minetypes | Used to encode the content of the form |
method | get post |
Specifies the HTTP method to used when the form is submitted |
name | form name | Defines a unique name for the form |
nonvalidate | nonvalidate | Specifies that theform should not be validated when submitted |
target | _blank _parent _self _top |
Specifies where to open the target URL _blank = the target URL will open in a new window. _self = the target URL will open in the same frame as it was clicked. _parent = the target URL will open in the parent frameset. _top = the target URL will open in the full body of the window |
Global Attribute
Form Tag support all the global attributes of HTML.
Event Attribute
Form Tag support all the event attributes of HTML.
Next Tutorial
We hope that this tutorial helped you develop better understanding of the concept of form tag in HTML.
Keep Learning : )
In the next tutorial, you'll learn about HTML <h1> to <h6>
Tag.