Numeric HTML input element test page

This page lists various alternatives for numeric input element types, and results for different phones / browsers. The goal is to have a numeric input element that opens a numeric keyboard for user input.

The setSelectionRange and select links execute element.setSelectionRange(3,6) and element.select(), respectively. (Note that the WHATWG Living standard indicates that these methods are not applicable for all input types.)

Legend:

iOS  iOS default browser (iOS version number)
AAndroid default browser (Android version number)
CMChrome Mobile on Android (Chrome version number)
WPWindows Phone
CChrome (desktop)
FFFirefox (desktop)
IEInternet Explorer (desktop)

Unless otherwise noted, the expected behavior is simple text fields (same at type="text"), preceding zeros are retained and both setSelectionRange and select functioning.

General notes:

JavaScript errors:
Input type Empty input Integer Preceding zero Negative number Decimal point Selection Notes
<input type="number">

onChange


setSelectionRange select
A4.3: Numeric keyboard without minus or decimal point.
A4.1: Numeric keyboard with minus, decimal point and dysfunctional comma
A2.3: Numeric/telephone keyboard (minus available, dot under ?#+)
CM33: Numeric keyboard without minus or decimal point. setSelectionRange throws exception.
WP8: Numeric keyboard with decimal comma without minus.
iOS6: QWERTY keyboard in numeric mode (comma and minus available). Preceding zero removed.
C32: Spinner arrows
C33: Spinner arrows on hover. setSelectionRange throws exception.
FF27, IE10: Normal
<input type="number" min="-1000.0" max="1000.0" step="0.1">

onChange


setSelectionRange select
A4.3: Numeric keyboard without minus or decimal point.
A4.1: Numeric keyboard with minus, decimal point and dysfunctional comma
A2.3: Numeric/telephone keyboard (minus available, dot under ?#+)
CM33: Numeric keyboard without minus or decimal point. setSelectionRange throws exception.
WP8: Numeric keyboard with decimal comma without minus. iOS6: QWERTY keyboard in numeric mode (comma and minus available). Preceding zero removed.
C32: Spinner arrows
C33: Spinner arrows on hover. setSelectionRange throws exception.
FF27, IE10: Normal
<input type="number" min="-1000.0" max="1000.0" step="any">

onChange


setSelectionRange select
A4.3: Numeric keyboard without minus or decimal point.
A4.1: Numeric keyboard with minus, decimal point and dysfunctional comma
A2.3: Numeric/telephone keyboard (minus available, dot under ?#+)
CM33: Numeric keyboard without minus or decimal point. setSelectionRange throws exception.
WP8: Numeric keyboard with decimal comma without minus. iOS6: QWERTY keyboard in numeric mode (comma and minus available). Preceding zero removed.
C32: Spinner arrows
C33: Spinner arrows on hover. setSelectionRange throws exception.
FF27, IE10: Normal
<input type="tel">

onChange


setSelectionRange select
A4.3: Telephone input keyboard (dot and dash available under 'Sym')
A4.1: Telephone input keyboard (dot and dash available)
A2.3: Numeric/telephone keyboard (minus available, dot under ?#+)
CM33: Telephone input keyboard
WP8: Telephone input (dot and dash available)
iOS6: Telephone input (dot and dash unavailable)
FF27, C32, C33, IE10: Normal
<input type="text" inputmode="latin digits">
W3 Input modes

onChange


setSelectionRange select
A4.3: Text keyboard
A4.1: Text keyboard
A2.3: Text keyboard
CM33: Text keyboard
WP8: Text keyboard
iOS6: Text keyboard
FF27, C32, C33, IE10: Normal
<input type="text" pattern="[0-9]*">
Safari Developer Library

onChange


setSelectionRange select
A4.3: Text keyboard
A4.1: Text keyboard
A2.3: Text keyboard
CM33: Text keyboard
WP8: Text keyboard
iOS6: Large number-only keyboard, minus and dot not available
FF27, C32, C33, IE10: Normal
<input type="text" pattern="-?[0-9]*">

onChange


setSelectionRange select
A4.3: Text keyboard
A4.1: Text keyboard
A2.3: Text keyboard
CM33: Text keyboard
WP8: Text keyboard
iOS6: Text keyboard
FF27, C32, C33, IE10: Normal
<input type="text" pattern="[0-9.]*">

onChange


setSelectionRange select
A4.3: Text keyboard
A4.1: Text keyboard
A2.3: Text keyboard
CM33: Text keyboard
WP8: Text keyboard
iOS6: Text keyboard
FF27, C32, C33, IE10: Normal
<input type="text">
For reference

onChange


setSelectionRange select
<input type="email">
For reference

onChange


setSelectionRange select
A4.3: Email keyboard
A4.1: Email keyboard
A2.3: Email keyboard
CM33: Email keyboard. setSelectionRange throws exception.
WP8: Email keyboard
iOS6: Email keyboard
FF27, C32, C33, IE10: Normal

Tested devices:

Cause JavaScript error (for testing onerror handler)