HTML Input Attributes <input> element के behavior, appearance और validation को control करते हैं।
इन attributes की मदद से input field को ज़्यादा powerful और user-friendly बनाया जाता है।
type Attribute
type attribute input का प्रकार define करता है।
<input type="text">
<input type="email">
<input type="password">
name Attribute
name attribute form submission के समय data की पहचान करता है।
<input type="text" name="username">
Server-side processing में यह बहुत important होता है।
value Attribute
value attribute input की default value set करता है।
<input type="text" value="Dinesh">
placeholder Attribute
placeholder input के अंदर hint text दिखाता है।
<input type="text" placeholder="Enter your name">
User typing शुरू करते ही यह text गायब हो जाता है।
readonly Attribute
readonly input को read-only बना देता है।
<input type="text" value="India" readonly>
User value change नहीं कर सकता लेकिन copy कर सकता है।
disabled Attribute
disabled input को completely disable कर देता है।
<input type="text" disabled>
Disabled input form के साथ submit नहीं होता।
required Attribute
required input को mandatory बना देता है।
<input type="email" required>
Form submit करने से पहले browser validation करता है।
maxlength Attribute
maxlength maximum characters limit set करता है।
<input type="text" maxlength="10">
minlength Attribute
minlength minimum characters limit define करता है।
<input type="password" minlength="6">
min और max Attribute
Numeric या date inputs के लिए range set करते हैं।
<input type="number" min="1" max="100">
<input type="date" min="2024-01-01" max="2025-12-31">
step Attribute
step input value का interval define करता है।
<input type="number" step="5">
size Attribute
size input field की visible width set करता है।
<input type="text" size="30">
autofocus Attribute
Page load होते ही input पर focus आ जाता है।
<input type="text" autofocus>
autocomplete Attribute
Browser auto-fill behavior control करता है।
<input type="text" autocomplete="on">
<input type="password" autocomplete="off">
pattern Attribute
Custom validation के लिए regular expression use करता है।
<input type="text" pattern="[A-Za-z]{3,}">
multiple Attribute
Multiple values allow करता है।
<input type="file" multiple>
<input type="email" multiple>
checked Attribute
Radio और checkbox के लिए default selection set करता है।
<input type="checkbox" checked>
accept Attribute
File upload में allowed file types define करता है।
<input type="file" accept=".jpg,.png">
form Attribute
Input को किसी specific form से link करता है।
<input type="text" form="loginForm">
HTML Input Attributes Summary
Input attributes behavior और validation control करते हैं
HTML5 attributes से JavaScript की dependency कम होती है
Proper attributes बेहतर user experience देते हैं
Form security और usability दोनों improve होती हैं
