We help IT Professionals succeed at work.

HTML5 Input type Number - stop auto formatting

rito1
rito1 asked
on
Hi All,

I am developing a HTML5 app for the iPad and what I am finding at the moment is that when using the input type 'number' it is auto formatting the value with a thousand separator e.g. 1000 is being forced to 1,000.

Is there any way to turn this option off other than changing the input type to 'text'? - I don't want to lose the number keyboard by default.

Many thanks,

Rit
Comment
Watch Question

Top Expert 2011

Commented:
Good question!
Closest answer I can see is to try changing it to type=tel.
You should still get the number keyboard and not any of the formatting.

Author

Commented:
Yeah, I see what you mean. It's just a shame that it then becomes symantically incorrect. Also what surprises will the next version of browsers hold for the tel input type and my general number values.
Top Expert 2011
Commented:
I have not looked into it, is there a way to tell it which keyboard to use in case you don't want it to use the standard one for that input type?

Author

Commented:
Until tonight my understanding was the the keyboard changes depending on the input type specified.

But I just found that the following forces the number keyboard to show and as the input type is text, Safari on the iPad doesn't apply the auto formatting! Voila!

<input type="text" name="myName" min="1" max="10" pattern="[0-9]*" />

Thanks for being there.

Rit