HTML5 - Open numeric keyboard iPhone

4.4k Views Asked by At

Possible Duplicate:
HTML5 Form Input Pattern Currency Format

Is there a way to open the numeric keyboard using input type="text"? I know type="number" will open the numeric keyboard, but it won't take money values. For instance, if you input 1.00, it turns into 1 on an iOS product. Also, this only happens on iOS devices. It works fine on Android, and all web browsers.

I've tried playing around with patterns and patterns="[1-9]*" opens the phone number pad. Is there possibly one that will open the numeric keyboard?

2

There are 2 best solutions below

0
iOSAndroidWindowsMobileAppsDev On

To answer:

  1. Yes nput type="text" exists in html5 http://www.w3schools.com/html/html5_form_input_types.asp

  2. type="number" can be formatted to two decimal places using jquery .toFixed(2) http://www.w3schools.com/jsref/jsref_tofixed.asp

  3. jquery mobile is not your language of choice but it does customize the keyboard for some inputs, e.g. date You might want to try it, it's very similar to html http://jquerymobile.com/

0
Peter Elliott On

try using this, which should open the numeric keyboard in iOS (and also open the number input keyboard in Android):

<input type="number" step="0.01">