HTML5输入数最小值最大值无法使用所需 [英] HTML5 input number min max not working with required

查看:980
本文介绍了HTML5输入数最小值最大值无法使用所需的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想强制使用者输入年龄。我也想确保他们只进入18-99之间。这是可能的 HTML5 属性如必需 pattern min max ?似乎无效

I would like to force the user to type their age. I also would like to make sure they only enter between 18-99. Is that possible with HTML5 attributes like required, pattern, min and max? Seems like it is not working

<form>
    <input type="number" name="Q2age" id="Q2age" size="10" min="18" max="99" pattern="[1-8][0-9]" required>
    <button type="submit" class="button" id="test">Submit</button>
</form>

我在这里做错了吗?我在Ubuntu 12.0.4LTS上使用Firefox 22.0(在Chrome上测试,但不工作。)感谢您的帮助。

Am I doing something wrong here? I use Firefox 22.0 on Ubuntu 12.0.4LTS (tested on Chrome as well, but doesn't work.) Thank you for your help.

推荐答案

这是预期的行为,因为FF21不支持min,max属性...

This is the expected behaviour because FF21 doesnt supports min,max attribute...

你可以在 http://html5test.com/

检查屏幕截图

Check the screenshot

这篇关于HTML5输入数最小值最大值无法使用所需的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆