30 HTML Form Attributes You’re Not Using (But Should be)
They’re well-supported, practical, and they’ll make your forms better today.
HTML forms have been around forever, but honestly, most developers are still writing the same basic forms they learned years ago. Meanwhile, HTML has been quietly adding powerful attributes that can save you from writing tons of JavaScript. I’m talking about validation, user experience improvements, and accessibility features that are just sitting there, ready to use.
Let me walk you through 30 form attributes that you’re probably not using but absolutely should. These aren’t obscure features. They’re well-supported, practical, and they’ll make your forms better today.
Note: Browser support listed shows minimum versions. Most attributes work in all modern browsers.
Before you go any further, here is the complete code example for you:
1. autocomplete
This tells the browser what kind of data goes in a field so it can autofill intelligently.
<input type=”email” name=”email” autocomplete=”email”>
<input type=”tel” name=”phone” autocomplete=”tel”>
<input type=”text” name=”cc-number” autocomplete=”cc-number”>Users love autofill. Don’t make them type their email for the hundredth time. Use proper autocomplete values like email, tel, street-address, cc-number, bday, and dozens more.
Browser Support: Universal support in all modern browsers. Chrome 17+, Firefox 4+, Safari 5.1+, Edge 12+
2. autofocus
Automatically focuses an input when the page loads. Perfect for search boxes or login forms.
<input type=”text” name=”search” autofocus>Use this sparingly. Only autofocus one field, and make sure it’s what users actually want to interact with first.
Browser Support: Chrome 5+, Firefox 4+, Safari 5+, Edge 12+, IE 10+
3. inputmode
Tells mobile devices which keyboard to show. This is huge for mobile UX.
<input type=”text” inputmode=”numeric”>
<input type=”text” inputmode=”decimal”>
<input type=”text” inputmode=”email”>
<input type=”text” inputmode=”url”>Even if you’re using type=”text” for validation reasons, inputmode gives mobile users the right keyboard. Use numeric for PIN codes, decimal for prices, email for emails.
Browser Support: Chrome 66+, Firefox 95+, Safari 12.1+, Edge 79+, iOS Safari 12.2+
4. pattern
Custom validation with regex. This is incredibly powerful.
<input type=”text” pattern=”[0-9]{4}” placeholder=”PIN (4 digits)”>
<input type=”text” pattern=”[A-Za-z]{3,}” placeholder=”At least 3 letters”>The browser validates against your pattern and shows an error message if it doesn’t match. Works with title attribute to show helpful error messages.
Browser Support: Chrome 10+, Firefox 4+, Safari 10.1+, Edge 12+, IE 10+
5. title (with pattern)
When used with pattern, title becomes the error message.
<input type=”text”
pattern=”[0-9]{4}”
title=”Please enter exactly 4 digits”>Don’t skip this. The default error messages are terrible. Give users helpful feedback.
Browser Support: Universal support in all browsers
6. minlength and maxlength
Set minimum and maximum character limits. Not just for validation, but browsers show a character counter in some cases.
<input type=”text” minlength=”3” maxlength=”20”>
<textarea minlength=”10” maxlength=”500”></textarea>Users get instant feedback if they try to submit too short or too long content.
Browser Support:
maxlength: Universal support (Chrome 4+, Firefox 4+, Safari 5+, IE 10+)minlength: Chrome 40+, Firefox 51+, Safari 10.1+, Edge 17+ (No IE support)
7. min and max
For number and date inputs, set boundaries.
<input type=”number” min=”1” max=”100”>
<input type=”date” min=”2025-01-01” max=”2025-12-31”>
<input type=”time” min=”09:00” max=”17:00”>The browser won’t let users pick invalid values. No JavaScript needed.
Browser Support: Chrome 10+, Firefox 16+, Safari 5+, Edge 12+, IE 10+
8. step
Controls the increment for number inputs and date/time pickers.
<input type=”number” step=”0.01” placeholder=”Price”>
<input type=”time” step=”900”> <!-- 15-minute intervals -->
<input type=”range” min=”0” max=”100” step=”5”>Use step=”0.01” for money, step=”any” for decimals with no restrictions.
Browser Support: Chrome 6+, Firefox 16+, Safari 5+, Edge 12+, IE 10+
9. multiple
Allows multiple file uploads or multiple email addresses.
<input type=”file” multiple>
<input type=”email” multiple placeholder=”Separate emails with commas”>For file inputs, users can select multiple files at once. For email inputs, browsers validate each email in the comma-separated list.
Browser Support: Chrome 6+, Firefox 3.6+, Safari 4+, Edge 12+, IE 10+
10. accept
Restricts file input to specific file types.
<input type=”file” accept=”image/*”>
<input type=”file” accept=”.pdf,.doc,.docx”>
<input type=”file” accept=”image/png,image/jpeg”>Use image/* for any image, video/* for videos, or specific MIME types and extensions. The file picker will filter accordingly.
Browser Support: Chrome 16+, Firefox 9+, Safari 6+, Edge 12+, IE 10+
11. formnovalidate
Skips validation for a specific submit button. Super useful for “Save Draft” buttons.
<button type=”submit”>Submit</button>
<button type=”submit” formnovalidate>Save Draft</button>The form validates on normal submit but bypasses validation when saving drafts.
Browser Support: Chrome 10+, Firefox 4+, Safari 10.1+, Edge 12+, IE 10+
12. formaction
Changes where the form submits when using a specific button.
<form action=”/save”>
<button type=”submit”>Save</button>
<button type=”submit” formaction=”/preview”>Preview</button>
</form>Different buttons can submit to different endpoints without JavaScript.
Browser Support: Chrome 10+, Firefox 4+, Safari 5.1+, Edge 12+, IE 10+
13. formmethod
Overrides the form’s method for a specific button.
<form method=”get” action=”/search”>
<button type=”submit”>Search</button>
<button type=”submit” formmethod=”post”>Save Search</button>
</form>Allows different buttons to use different HTTP methods (GET or POST).
Browser Support: Chrome 10+, Firefox 4+, Safari 5.1+, Edge 12+, IE 10+
14. formenctype
Overrides the form’s encoding type for a specific submit button.
<form>
<input type=”text” name=”title”>
<button type=”submit”>Save Text</button>
<button type=”submit” formenctype=”multipart/form-data”>Upload File</button>
</form>Use this when one button needs to handle file uploads but others don’t.
Browser Support: Chrome 10+, Firefox 4+, Safari 5.1+, Edge 12+, IE 10+
15. formtarget
Specifies where to display the response for a specific submit button.
<form action=”/submit”>
<button type=”submit”>Submit</button>
<button type=”submit” formtarget=”_blank”>Submit in New Tab</button>
</form>Values include _self, _blank, _parent, _top, or a named frame. Useful for preview buttons or when you want to keep the current page open.
Browser Support: Chrome 10+, Firefox 4+, Safari 5.1+, Edge 12+, IE 10+
16. readonly
Makes an input unchangeable but still submits its value. Different from disabled.
<input type=”text” value=”Order #12345” readonly>Use readonly when you want the value submitted but don’t want users changing it. Use disabled when you don’t want the value submitted at all.
Browser Support: Universal support in all browsers
17. placeholder
Shows hint text inside the input. You’re probably using this already, but use it right.
<input type=”email” placeholder=”you@example.com”>Don’t use placeholder as a label replacement. Placeholders disappear when users start typing. Always use proper <label> elements.
Browser Support: Chrome 10+, Firefox 4+, Safari 5+, Edge 12+, IE 10+
18. list and <datalist>
Creates a dropdown of suggestions that users can select from or ignore.
<input type=”text” list=”browsers”>
<datalist id=”browsers”>
<option value=”Chrome”>
<option value=”Firefox”>
<option value=”Safari”>
<option value=”Edge”>
</datalist>It’s like autocomplete but you control the suggestions. Users can type freely or pick from your list.
Browser Support: Chrome 20+, Firefox 4+, Safari 12.1+, Edge 12+ (No IE support)
19. spellcheck
Controls whether the browser should spellcheck the field.
<textarea spellcheck=”true”></textarea>
<input type=”text” name=”code” spellcheck=”false”>Turn it off for code inputs, usernames, or technical fields. Keep it on for text areas and content fields.
Browser Support: Chrome 10+, Firefox 2+, Safari 3.1+, Edge 12+, IE 10+
20. enterkeyhint
Changes the Enter key label on mobile keyboards.
<input type=”search” enterkeyhint=”search”>
<input type=”text” enterkeyhint=”next”>
<textarea enterkeyhint=”send”></textarea>Values include enter, done, go, next, previous, search, send. This is purely for mobile UX but makes a big difference.
Browser Support: Chrome 77+, Firefox 94+, Safari 13.1+, Edge 79+, iOS Safari 13.4+
21. dirname
Automatically submits the text direction of the input. Crucial for international forms.
<input type=”text” name=”comment” dirname=”comment.dir”>When the form submits, it includes both comment (the value) and comment.dir (either ltr or rtl). Essential for proper handling of right-to-left languages like Arabic or Hebrew.
Browser Support: Chrome 17+, Safari 6+, Edge 79+ (No Firefox or IE support)
22. form
Associates an input with a form even if it’s outside the <form> element.
<form id=”myForm” action=”/submit”>
<input type=”text” name=”username”>
</form><input type=”email” name=”email” form=”myForm”>
<button type=”submit” form=”myForm”>Submit</button>Useful when your form is in one part of the page but you need inputs or buttons elsewhere. The form attribute links them together.
Browser Support: Chrome 10+, Firefox 4+, Safari 5.1+, Edge 12+, IE 11+
23. capture
For mobile file inputs, opens the camera directly instead of the file picker.
<input type=”file” accept=”image/*” capture=”environment”>
<input type=”file” accept=”video/*” capture=”user”>Use capture=”user” for front camera, capture=”environment” for back camera. Perfect for apps where users need to take photos or videos directly.
Browser Support: Chrome 53+ (Android), Safari 11+ (iOS), Samsung Internet 6.2+. Desktop browsers ignore this attribute.
24. novalidate
Disables HTML5 validation for the entire form.
<form novalidate>
<input type=”email” required>
<button type=”submit”>Submit</button>
</form>Use this when you’re handling validation entirely with JavaScript or want to implement custom validation logic.
Browser Support: Chrome 10+, Firefox 4+, Safari 10.1+, Edge 12+, IE 10+
25. autocapitalize
Controls automatic capitalization on mobile keyboards.
<input type=”text” autocapitalize=”words”>
<input type=”text” autocapitalize=”sentences”>
<input type=”email” autocapitalize=”none”>Values: none, sentences, words, characters. Use none for emails and usernames, words for names, sentences for regular text.
Browser Support: Safari 5+ (iOS), Chrome 43+, Edge 79+. Firefox doesn’t support this attribute.
26. size
Sets the visible width of the input in characters.
<input type=”text” size=”30”>
<input type=”text” size=”5” placeholder=”Code”>This doesn’t limit the input, just controls how wide it displays. Use maxlength if you want to limit actual input length.
Browser Support: Universal support in all browsers
27. cols and rows
Controls the visible dimensions of a textarea.
<textarea cols=”50” rows=”10”></textarea>cols sets the width in characters, rows sets the height in lines. Users can still resize if you don’t set CSS to prevent it.
Browser Support: Universal support in all browsers
28. wrap
Controls how text wrapping works in textarea when submitting.
<textarea wrap=”soft”></textarea>
<textarea wrap=”hard” cols=”40”></textarea>soft doesn’t add line breaks to submitted text, hard adds line breaks at the specified cols width. Most of the time you want soft.
Browser Support: Universal support in all browsers
29. disabled
Disables an input completely. It won’t be editable or submitted.
<input type=”text” disabled>
<button type=”submit” disabled>Submit</button>Different from readonly. Disabled inputs don’t submit their values and typically appear grayed out. Use when fields are temporarily unavailable.
Browser Support: Universal support in all browsers
30. required
Makes a field mandatory before the form can submit.
<input type=”text” required>
<input type=”email” required>
<select required>
<option value=”“>Choose one...</option>
<option value=”1”>Option 1</option>
</select>The browser shows an error if users try to submit without filling required fields. Works with all input types.
Browser Support: Chrome 10+, Firefox 4+, Safari 10.1+, Edge 12+, IE 10+
Why These Matter
Here’s the thing. These attributes aren’t fancy or new. They’re built into HTML, supported by browsers, and they solve real problems. Most developers reach for JavaScript when HTML already has the answer.
Use these attributes and you get:
Better user experience with less code
Native browser validation that works everywhere
Accessibility features built right in
Mobile-optimized keyboards and interactions
Less JavaScript to maintain
Browser Support Summary
Excellent Support (Works everywhere):
autocomplete,autofocus,title,readonly,placeholder,size,cols,rows,wrap,disabled,spellcheckHTML5 validation:
required,pattern,min,max,step,multiple,acceptForm button overrides:
formaction,formmethod,formenctype,formtarget,formnovalidate,novalidate
Modern Browsers Only:
inputmode: Chrome 66+, Firefox 95+, Safari 12.1+enterkeyhint: Chrome 77+, Firefox 94+, Safari 13.1+minlength: Chrome 40+, Firefox 51+, Safari 10.1+ (No IE)datalist: Chrome 20+, Firefox 4+, Safari 12.1+ (No IE)
Limited/Mobile-Specific:
capture: Mobile browsers only (Chrome Android 53+, iOS Safari 11+)autocapitalize: Safari/iOS, Chrome 43+ (No Firefox)dirname: Chrome 17+, Safari 6+ (No Firefox or IE)
Start Using Them Today
You don’t need to use all 30 at once. Pick a few that solve problems you’re dealing with right now. Add inputmode to your mobile forms. Use pattern instead of writing custom validation. Try formnovalidate for your draft buttons. Add capture for camera uploads.
These aren’t unknown features waiting for browser support. Start using them.
Just a Quick Reference:
<!-- Validation -->
<input required minlength=”3” maxlength=”20” pattern=”[A-Za-z]+”>
<form novalidate><!-- Mobile UX -->
<input inputmode=”numeric” enterkeyhint=”next” autocomplete=”tel” autocapitalize=”words”>
<input type=”file” accept=”image/*” capture=”environment”>
<!-- File uploads -->
<input type=”file” accept=”image/*” multiple>
<!-- Advanced buttons -->
<button formnovalidate>Save Draft</button>
<button formaction=”/preview” formtarget=”_blank”>Preview</button>
<button formmethod=”delete”>Delete</button>
<button formenctype=”multipart/form-data”>Upload</button>
<!-- Suggestions -->
<input list=”suggestions”>
<datalist id=”suggestions”>
<option value=”Option 1”>
<option value=”Option 2”>
</datalist>
<!-- Textarea -->
<textarea cols=”50” rows=”10” wrap=”soft” spellcheck=”true”></textarea>
<!-- Input states -->
<input readonly>
<input disabled>
<!-- Text direction -->
<input dirname=”comment.dir”>Did you learn something good today?
Then show some love. 🫰
©
WordPress Developer | Website Strategist | SEO Specialist
Don’t forget to subscribe to Developer’s Journey to show your support.






Bookmarking this. My SEO fundamentals slipped, and this is exactly the fix I needed.