简体   繁体   English

手机号码键盘无法在 Iphone 中使用

[英]Mobile number keyboard won't work in Iphone

I'm developing a web app that is an online shop of gym plans, as it is a web app, it will run on both pc and mobile, but i'm having a little problem with the numeric keyboard in mobile (when you put the type of the input as number), it works in any browser in android, but when i try in Iphone, it opens the regular keyboard.我正在开发一个网络应用程序,它是一个健身房计划的在线商店,因为它是一个网络应用程序,它可以在个人电脑和移动设备上运行,但我在移动设备上的数字键盘有一个小问题(当你把输入的类型为数字),它可以在 android 中的任何浏览器中使用,但是当我在 Iphone 中尝试时,它会打开常规键盘。

The code is very simple actually.代码其实很简单。 It's a simple form about the way of payment.这是关于付款方式的简单表格。

<form>
    <div class="form-group">
        <label for="cardOwnerName">Owner's Name</label>
        <input type="text" id="cardOwnerName" />
    </div>
    <div class="form-group">
        <label for="cardNumber">Card's Number</label>
        <input type="number" id="cardNumber" />
    </div>
    <div class="form-group">
        <label for="cardExpire">Expire Date</label>
        <input type="date" id="cardExpire" />
    </div>
    <div class="form-group">
        <label for="cardCVV">CVV</label>
        <input type="number" id="cardCVV" />
    </div>
</form>

So, when i execute this code in an android celphone, when i click in the cardNumber's field the numeric keyboard opens, but when i execute the same code in my IOS, it doesn't open.因此,当我在 android celphone 中执行此代码时,当我单击 cardNumber 的字段时,数字键盘会打开,但是当我在 IOS 中执行相同的代码时,它不会打开。

Is there anything i have to do besides put the input as number to it to work in Iphones?除了将输入作为数字输入它以在 Iphones 中工作之外,还有什么我必须做的吗?

Compatible with Android and iOS is "inputmode".兼容AndroidiOS的是“输入模式”。

Try <input inputmode="numeric" pattern="[0-9]*" type="text" id="cardNumber">试试<input inputmode="numeric" pattern="[0-9]*" type="text" id="cardNumber">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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