The HTML Form Elements can contain one or more of the following form elements:
<input type="text">
: This creates a text input field where users can type in text.<input type="password">
: This creates a password input field where the user’s input is hidden as they type.<input type="checkbox">
: This creates a checkbox that can be checked or unchecked by the user.<input type="radio">
: This creates a radio button that the user can select. Radio buttons are used when only one option can be selected from a group of options.<select>
and<option>
: These elements are used to create drop-down menus. The<select>
element creates the menu, and the<option>
elements define the options in the menu.<textarea>
: This creates a text area where users can type in longer blocks of text.<input type="submit">
: This creates a button that, when clicked, submits the form data to the server.<input type="reset">
: This creates a button that, when clicked, resets the form fields to their default values.<input type="file">
: This creates a file upload field where users can select a file from their computer to upload.<input type="hidden">
: This creates a hidden field that is not visible to the user, but can be used to store data that needs to be submitted with the form.<input type="date">
: This creates a date input field where the user can select a date from a calendar.<input type="email">
: This creates an email input field where the user can enter an email address.<input type="number">
: This creates a number input field where the user can enter a numeric value.<input type="range">
: This creates a range input field where the user can select a value from a range by dragging a slider.<input type="color">
: This creates a color input field where the user can select a color from a color picker.
Commonly used HTML form elements:
<form>
– Defines a form for user input.<input>
– Defines an input field where the user can enter data.<textarea>
– Defines a multi-line input field where the user can enter data.<select>
– Defines a drop-down list.<option>
– Defines an option in a drop-down list.<button>
– Defines a clickable button.<label>
– Defines a label for an input element.<fieldset>
– Groups related elements in a form.<legend>
– Defines a caption for a<fieldset>
element.<datalist>
– Defines a list of pre-defined options for an<input>
element.<optgroup>
– Groups related options in a drop-down list.<progress>
– Displays the progress of a task.<meter>
– Defines a scalar measurement within a known range.<output>
– Defines the result of a calculation.