
INPUT TAG
The <input> element in HTML is a versatile tool used to create interactive controls for web forms. It's a self-contained tag that doesn't have a closing tag, and its behavior is defined by various attributes, especially the type attribute, which determines the type of input control it creates.
Here's an overview of the <input> element's attributes and how they are commonly used:
1. type: This attribute specifies the type of input control to display. Some common values include:
i. text : A single-line text input field.
ii. password : A password input field (text is masked).
iii. checkbox : A checkbox for selecting one or more options.
iv. button : A generic button.
v. radio : A radio button for selecting one option from a group.
vi. submit : A submit button to submit a form.
vii. reset : A reset button to reset form fields to their initial values.
viii. file : A file input field for uploading files.
3. placeholder:This attribute provides a hint to the user about what information is expected in the input field. It typically appears as faint text when the input field is empty.
Output :
Last name:
In this example,
i. Name:This attribute specifies the name of the input control. When a form is submitted, the data entered into the input field is sent to the server with the name as the key.
ii. value: This attribute specifies the initial value of the input field. For text inputs, it sets the default text. For checkboxes and radio buttons, it defines the value that gets submitted when the input is checked.