The HTML <input> element is essential for creating interactive forms. It is widely used to collect user input.
Let’s explore this crucial element a bit more and understand how it can be configured to meet different input needs.
The <input> element can take on a variety of shapes and functionalities depending on the specific attribute that is assigned to it. The variation is controlled by the type
attribute, which defines the type of input field that will be displayed.
For example, the type
can be configured to create text fields, checkboxes, radio buttons, and more.
By using the <input> element, developers have the flexibility to create a wide range of input fields for users to fill in.
Text fields, where users can enter free-form text, and checkboxes, which allow for selecting between predefined options, are just a few examples of what can be accomplished with this versatile element.
Here are some examples:
Tipo | Descrição: |
---|---|
<input type=”text”> | Displays a single-line text input field |
<input type=”radio”> | Displays an option button (to select one of many options) |
<input type=”checkbox”> | Displays a check box (to select zero or more of many options) |
<input type=”submit”> | Displays a submit button (to submit the form) |
<input type=”button”> | Displays a clickable button |