Why use HTML Form?
The <form> Element
The HTML <form>
element is used to create an HTML form for user input:
<form>
<!--form elements-->
</form>
The <form>
element is a container for different types of input elements, such as text fields, checkboxes, radio buttons, submit buttons, etc.
Form elements
These are the following HTML <form> elements:
<label>: It defines label for <form> elements.
<input>: It is used to get input data from the form in various types such as text, password, email, etc by changing its type.
<button>: It defines a clickable button to control other elements or execute a functionality.
<select>: It is used to create a drop-down list.
<textarea>: It is used to get input long text content.
<fieldset>: It is used to draw a box around other form elements and group the related data.
<legend>: It defines caption for fieldset elements.
<datalist>: It is used to specify pre-defined list options for input controls.
<output>: It displays the output of performed calculations.
<option>: It is used to define options in a drop-down list.
<optgroup>: It is used to define group-related options in a drop-down list.
Here are some examples of form html:
Type | Description |
---|---|
<input type="text"> | Displays a single-line text input field |
<input type="radio"> | Displays a radio button (for selecting one of many choices) |
<input type="checkbox"> | Displays a checkbox (for selecting zero or more of many choices) |
<input type="submit"> | Displays a submit button (for submitting the form) |
<input type="button"> | Displays a clickable button |
Comments :
Post a Comment