Syntax
<input inputmode="numeric" enterkeyhint="done" pattern="[0-9]{6}">Examples
Mobile Keyboard Hints: inputmode and enterkeyhint: working example
Save as an HTML file and open it in a browser. Expected result: Mobile browsers may show a numeric keyboard; submission accepts exactly six ASCII digits, including leading zeroes.
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Working example</title>
</head>
<body>
<form>
<label for="code">Six-digit verification code</label>
<input id="code" name="code" type="text" inputmode="numeric" enterkeyhint="done" autocomplete="one-time-code" pattern="[0-9]{6}" maxlength="6" required>
<button type="submit">Verify</button>
</form>
<script>
document.querySelector("form").addEventListener("submit", event => {
event.preventDefault();
alert("Code format accepted");
});
</script>
</body>
</html>- Expected result: Mobile browsers may show a numeric keyboard; submission accepts exactly six ASCII digits, including leading zeroes.
- type="text" preserves an identifier such as 001234.
- pattern and required enforce the format independently of the keyboard hint.
Best practices
- Always validate the code and its expiry on the server in a real application.
- Avoid number inputs for identifiers that have no arithmetic meaning.
Browser compatibility
Support applies to the named feature, not every attribute or behaviour in this article. Versions refer to browsers, not operating systems.
These attributes suggest keyboard behaviour; hardware keyboards and operating-system keyboards may not expose the same UI.
inputmode
Desktop
- Chrome
- Supported
From 66 - Firefox
- Supported
From 95 - Safari
- Supported
From 12.1 - Edge
- Supported
From 79 - Opera
- Supported
From 53
Mobile
- Safari on iOS
- Supported
From 12.2 - Chrome for Android
- Supported
From 66 - Firefox for Android
- Supported
From 79 - Samsung Internet
- Supported
From 9.0
MDN BCD record for this feature · MDN reference
Support history and limitations
Chrome
- From 66
Firefox
- From 95
- From 17 · Removed in 23 · Last supported version: 22
Safari
- From 12.1
Edge
- From 79
Opera
- From 53
Safari on iOS
- From 12.2 · Before iOS 13, inputmode="none" had no effect.
Chrome for Android
- From 66
Firefox for Android
- From 79
Samsung Internet
- From 9.0
enterkeyhint
Desktop
- Chrome
- Supported
From 77 - Firefox
- Supported
From 94 - Safari
- Supported
From 13.1 - Edge
- Supported
From 79 - Opera
- Supported
From 66
Mobile
- Safari on iOS
- Supported
From 13.4 - Chrome for Android
- Supported
From 77 - Firefox for Android
- Supported
From 94 - Samsung Internet
- Supported
From 12.0
MDN BCD record for this feature · MDN reference
Support history and limitations
Chrome
- From 77
Firefox
- From 94
Safari
- From 13.1
Edge
- From 79
Opera
- From 66
Safari on iOS
- From 13.4
Chrome for Android
- From 77
Firefox for Android
- From 94
Samsung Internet
- From 12.0
MDN BCD 8.1.5 · Dataset built 2026-10-08 · Mapping reviewed 2026-10-21. These dates are not individual browser-test or claim-verification dates. Unknown means the data does not establish support.