taygan
taygan

Reputation: 145

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

Upvotes: 8

Views: 2742

Answers (1)

ndreisg
ndreisg

Reputation: 1179

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"/>

Upvotes: 8

Related Questions