This is input (numeric keyboard should be used)
<input type="number" id="Amount" maxlength="8" autocorrect="off"/>
this is JS attached to the input
$("#Amount").change(function() { this.value = formatNumber(this.value); });
where formatNumber formats value in pattern ###.###.### i.e. dot is used as a thousand separator, no decimals. Described behavior works on Android and desktop browsers, but fails on iPhone in this way:
- 123123 is turned into 123,123
- 123000 is turned into 123
How to turn off this behavior programmatically?
This is the best answer I found so far
So, type=”text” with pattern=”[0-9]*” will trigger numeric keyboard without automatic currency formatting. Works fine on Apple devices (iPad, iPhone), but doesn’t trigger numeric keyboard on Android devices. That’s way this JS is needed: