0

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?

Community
  • 1
  • 1
labatyo
  • 488
  • 7
  • 17
  • 1
    I found a similar answer already posted here http://stackoverflow.com/questions/5963158/html5-form-input-pattern-currency-format – runningRhetoric Dec 14 '12 at 15:17
  • http://stackoverflow.com/questions/6178556/iphone-numeric-keyboard-for-text-input – Daniel Kurz Dec 14 '12 at 15:23
  • I tried both these solutions. Using patterns on a type="number" field is good for rounding numbers, but iOS still drops the 0s after a decimal place. And pattern="\d*", from the 2nd comment, opens the phone number pad. I need the numeric keyboard. – labatyo Dec 14 '12 at 15:44
  • Here's a different solution that actually works: http://stackoverflow.com/a/25599024/1922144 – davidcondrey Sep 01 '14 at 05:11

2 Answers2

3

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">
Peter Elliott
  • 3,233
  • 14
  • 29
0

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/

rene
  • 37,946
  • 78
  • 99
  • 132