Reputation: 391
I am developing an iPhone application where I need to insert values with decimal point. I have tried step="any" or step="0.01" or but it doesn't show decimal point on numeric keyboard.I am using phone gap / cordova.
My current line of code is as <input name="abc" pattern="\d+(\.\d*)?" type="number">
Please help!! thank you.
Upvotes: 4
Views: 3406
Reputation: 1487
Try using pattern to your input type="number" field
pattern="\d+(\.\d*)?"
This will bring the full keyboard but in the number/symbol pane be default. The user can still switch to alphanumeric but upon onblur event, the pattern kicks in and removes any alphanumeric characters (but not numbers). It has to be both type="number" and pattern="\d+(.\d*)?" in order to work
But if you are developing for IOS you might find this question useful
iPhone - Adding a button to keyboard existing accessory view (keyboard from UIWebView)
Upvotes: 5