HTML Form Input Attributes
Form input attributes <input> tag ke andar use hote hain jo user se data lene ke liye hota hai.
1. Type
Defines the type of input
<input type="text">
<input type="email">
<input type="password">
<input type="number">
Common types:
- text
- email
- password
- number
- date
- file
- checkbox
- radio
2. name
specifies the name of the input (used when sending data to the server)
<input type="text" name ="username">
3. value
sets a default
<input type="text" value="john">
4. placeholder
Display hint text inside the input field
<input type="text" placeholder="Enter your name" >
5. Required
Makes the field mandatory
<input type="email" required >
6. readonly
User cannot edit the field
<input type="text" value=""LearnHTML" readonly >
7. disabled
Disables the input completely
<input type="text"disabled >
8. maxlength
Limits the maximum number of character
<input type="text" maxlength="10">
9. min and max
Sets minimum and maximum values (for number or date).
<input type="number" min="1" max="10">
10. pattern
Forces a specific format.
<input type="text" pattern="[A-Za-z]{3}">
(Only 3 letters allowed)