我输入了online cheesy riddle,用户应在其中输入一个浮点数。但是,我的输入现在允许用户仅滚动到整数:
<input style="width: 60px;" type="number" id="answer" placeholder="Answer" maxlength="3">
我找不到另一个type
来允许用户滚动到浮动页面(这可能是不现实的,因为用户需要滚动多少才能从.1到.2)。
在这种情况下,Web开发人员知道我的俗气谜语有没有简单的解决方法?
答案 0 :(得分:2)
将输入的step属性设置为所需的小数位数
<input style="width: 60px;" step="0.1" type="number" id="answer" placeholder="Answer" maxlength="3">