gpt4 book ai didi

html - 可以使 html 输入类型数字仅显示 5 的倍数的数字

转载 作者:搜寻专家 更新时间:2023-10-31 22:12:26 24 4
gpt4 key购买 nike

是否可以使 html 输入类型数字仅显示 5 的倍数 (5,10,15....)?

    <input type="number" name="pax">

最佳答案

仅适用于 HTML 5

<input type="number" name="pax" step="5">

还有其他 javascript 或 regex 解决方案,但它们不是必需的。

进一步阅读类型输入: http://www.w3schools.com/html/html_form_input_types.asp

这是一个使用一些更流行的数字输入属性的示例。

<input type="number" name="pax" min="0" max="100" step="5" value="0">

关于html - 可以使 html 输入类型数字仅显示 5 的倍数的数字,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/30609844/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com