In HTML, the <input>
element allows users to enter data in forms. The type
attribute specifies different input formats, such as text, numbers, passwords, checkboxes, and more.
✔ Text: Single-line input
<input type="text" placeholder="Enter your name">
✔ Password: Hidden input
<input type="password" placeholder="Enter password">
✔ Email: Accepts only valid emails
<input type="email" placeholder="Enter email">
✔ Number: Accepts only numbers
<input type="number" min="1" max="100">
✔ Range: Slider input
<input type="range" min="0" max="10">
✔ Checkbox: Multiple selections
<input type="checkbox"> Subscribe to newsletter
✔ Radio: Single selection
<input type="radio" name="gender" value="male"> Male
<input type="radio" name="gender" value="female"> Female
✔ Date: Select a specific date
<input type="date">
✔ Time: Select time
<input type="time">
file
→ Uploads files.image
→ Uses an image as a button.button
→ Clickable button (custom actions).submit
→ Submits the form.reset
→ Clears form input.
<form>
<input type="text" placeholder="Name">
<input type="email" placeholder="Email">
<input type="password" placeholder="Password">
<input type="submit" value="Submit">
</form>
Each input type enhances form usability.
@asadmukhtar