【问题标题】:Chrome input type number with minimum 0.1Chrome 输入类型编号,最小值为 0.1
【发布时间】:2016-05-26 05:27:19
【问题描述】:

HTML 数字字段微调器在 chrome 版本 48 中无法正常工作。当值为 0.1 时单击“向下”时,它会更改为 1.1。任何方法来克服这个问题。我希望它保持在 0.1。

<input type="number" min="0.1" step="any">

https://jsfiddle.net/praveen2288/wmcmag5h/

【问题讨论】:

    标签: html google-chrome html-input


    【解决方案1】:

    以下 sn-p 显示了带有浮点值的 &lt;input type="number"/&gt; 的行为:

    <strong>Step 0.1</strong><br/>
    <input type="number" min="0.1" step="0.1"/><br/>
    <strong>Step 1.0</strong><br/>
    <input type="number" min="0.1" step="1.0"/><br/>
    <strong>Step 1 (not working)</strong><br/>
    <input type="number" min="0.1" step="1"/><br/>
    <strong>Step 'any' (not working)</strong><br/>
    <input type="number" min="0.1" step="any"/><br/>

    【讨论】:

    • 同意。如果 step 是 1 或 any 怎么办?
    • 好的。我认为 step 需要是“1.0”,而不仅仅是“1”或“any”。 'any' 默认为 '1'
    【解决方案2】:

    您只需等到 Google Chrome 50 发布即可。这是 Google Chrome 的错误,最近已修复。 crbug.com/574066

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2016-05-23
      • 1970-01-01
      • 1970-01-01
      • 2020-09-29
      • 2014-03-04
      • 2023-03-21
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多