HTML Tutorial
HTML Forms
HTML Graphics
HTML Media
HTML API
HTML Form Elements
The HTML <form> Elements
The HTML <form> element consists of one or more of the following form elements:
- <input>
- <label>
- <select>
- <textarea>
- <button>
- <fieldset>
- <legend>
- <datalist>
- <output>
- <option>
- <optgroup>
The <input> Element
One of the commonly used form element is the <input> element.
The <input> element can be shown in various ways, depending on the type attribute.
Example
Output:
The <form> Element
The HTML <form> element creates an HTML form for user input:
<form>
….
form elements
…
</form>
The <form> element consists of different types of input elements, like: text fields, checkboxes, radio buttons, submit buttons, etc.
The <input> Element
The HTML <input> element is used commonly as form element.
An <input> element is shown in many ways, depending on the type attribute.
Text Fields
The <input type=”text”> specifies a single-line input field for text input.
Example
Output:
Radio Buttons
The <input type=”radio”> specifies a radio button.
Radio allows the user to select ONE of a limited number of choices.
Example
Output:
Checkboxes
The <input type=”checkbox”> defines a checkbox.
Checkboxes allows the user to select ZERO or MORE options of a limited number of choices.
Example
Output:
The Name Attribute for <input>
If the name attribute is removed, the value of the input field can not be sent at all.
Example
Output:
The Submit Button
The <input type=”submit”> specifies a button used for submitting the form data
The form-handler is used in the form’s action attribute.
Output: