显示只允许数字和小数点的输入? [英] Showing an input that only allows numbers and the decimal point?

查看:592
本文介绍了显示只允许数字和小数点的输入?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有任何方法来定义< input> ,显示只允许数字和小数点(或国际用户的逗号)的键盘输入? p>

< input type ='tel'> 显示我不需要的手机垃圾, br>
< input type ='number'pattern ='[0-9] *'> 显示所有数字,但不显示小数点



我能做些什么来获得我需要的输入?

解决方案

如果你是在真正的iOS应用程序中这样做,你可以在键盘上添加自己的按钮,基于此问题,这是关于附件视图,但相同的过程将工作。



否则,IamChuckB是正确的和 Apple开发者库中提供的五种键盘类型是详尽的。


Is there any way to define an <input> that shows a keyboard input that only allows numbers and the decimal point (or comma for international users)?

<input type='tel'> shows phone crap I don't need, and no decimal point
<input type='number' pattern='[0-9]*'> shows all numbers, but no decimal point

What can I do to get the input I need?

解决方案

If you were doing this in a bona fide iOS app, you could probably add buttons of your own on top of the keyboard, based on this question, which is about the accessory view but the same process would work.

Otherwise, IamChuckB is right and the five keyboard types given in the Apple Developer's Library are exhaustive.

这篇关于显示只允许数字和小数点的输入?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆