【问题标题】:Show Decimal Keyboard in HTML5 iOS 7 / iOS 8在 HTML5 iOS 7 / iOS 8 中显示十进制键盘
【发布时间】:2015-09-09 05:09:12
【问题描述】:

在搜索了几个小时后,我只有一个简单的问题:是否有可能在 webbrowsers 输入字段中显示十进制键盘? input type="number" 只显示数字,但我需要在左下角使用逗号或点。

我尝试了任何东西,patternstep 等,但没有任何东西能调出十进制键盘。我只需要数字和点或逗号,不需要 A-Z 或 a-z 或其他任何内容。

<input type="number" id="inputNumbers" pattern="[0-9]*" size="30" min="1" max="5">

这是我得到的:

这就是我想要的:

【问题讨论】:

    标签: javascript ios html css cordova


    【解决方案1】:
    【解决方案2】:

    https://github.com/mrchandoo/cordova-plugin-decimal-keyboard

    让您配置十进制字符(而不是.,您可以更改为,

    【讨论】:

      【解决方案3】:

      这适用于 iPhone 和 Android:

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

      iPhone 10 的键盘结果:

      Android:

      【讨论】:

        【解决方案4】:

        试试这个:

        EditText myEditText = (EditText)findViewById(R.id.myEditText);
        myEditText.setInputType(InputType.TYPE_NUMBER_FLAG_DECIMAL);
        

        或者:

        <input type="tel" />
        

        这有点小技巧:

        <input type="number" step="0.01">
        

        在输入值方面可能会起作用,具体取决于您要达到的目标

        此链接可能有用: Force iOS numeric keyboard with custom / currency pattern

        希望你来对了!

        【讨论】:

        • 你看过链接了吗?
        • 我当然做到了。不起作用,显示没有点或逗号的数字键盘。
        • 这些都不适合我。我在这里以一个不那么难看的解决方案结束stackoverflow.com/questions/14447668/…
        【解决方案5】:

        根据你的模式检查这个 html 代码

         <input type="text" pattern="[a-z]*">
        

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2014-10-10
          • 2015-06-20
          • 1970-01-01
          • 2015-02-03
          • 1970-01-01
          • 2014-11-01
          相关资源
          最近更新 更多