Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Enable Keyboard Type DecimalPad in Mobile Safari (via HTML)

Question: Is it possible to trigger the keyboard type: decimalPad in a HTML form rendered within mobile safari (i.e. numeric keyboard with a decimal point)?

Note: While a "numeric" keyboard is possible by specifying <input type="number" pattern="d\*" /> I have had no luck triggering a numeric keyboard with a decimal point. At this stage, it seems like this is only possible when building a native iOS application (as opposed to a web app).

Apple Documentation: https://developer.apple.com/library/archive/documentation/AppleApplications/Reference/SafariHTMLRef/Articles/InputTypes.html

like image 842
taygan Avatar asked Aug 31 '16 01:08

taygan


1 Answers

Since iOS 12 the inputmode attribute is supported by Safari (and by the WebView)

See here for browser support: https://caniuse.com/input-inputmode

<input type="number" pattern="\d*" inputmode="decimal"/>
like image 56
ndreisg Avatar answered Nov 10 '22 07:11

ndreisg