<input type="number" maxlength="5" class="search-form-input" name="techforge_apartmentbundle_searchformtype[radius]" id="techforge_apartmentbundle_searchformtype_radius">
@H_
403_4@这是我的HTML,用firebug(在chrome上)。
@H_
403_4@我可以在表单字段中编写尽可能多的字符 – 在Chrome和Safari中。
@H_
403_4@在Firefox或IE10上,限制很好。
@H_
403_4@我没有在网上找到这个问题。
@H_
403_4@注意:type =“number” – 不是文本。
@H_
403_4@有人以前见过这个问题吗?
对于type =“number”的输入使用max
属性。它将指定您可以插入的最高编号
<input type="number" max="999" />
@H_
403_4@如果同时
添加最大值和最小值,则可以指定允许值的范围:
<input type="number" min="1" max="999" />
@H_
403_4@见
example
@H_
403_4@编辑
@H_
403_4@如果为了
用户体验,您希望
用户不能输入超过一定
数量的数字,请使用Javascript / jQuery,如此
example所示