简体   繁体   中英

How to show numpad on mobile without using input type number/tel?

How to show numpad on mobile without using input type number/tel?

I have looked into this, but can't seem to find anything. I have an input that I cannot make into a number input because of some validations I'm doing. I was wondering how to show a numpad without using the input type number / tel ?

In an ideal world, the this is exactly what the inputmode attribute would let you do.

User agents can support the inputmode attribute on form controls (such as the value of textarea elements), or in elements in an editing host (eg, using contenteditable).

The inputmode content attribute is an enumerated attribute that specifies what kind of input mechanism would be most helpful for users entering content.

You would use it like this:

<input type="text" inputmode="numeric">

However, as of right now, it has limited support only being available in some of the most recent versions of Chrome and Chrome for mobile.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM