用于文本输入的HTML 5模式验证不适用于使用iphone的safari或firefox

时间:2014-04-11 13:28:33

标签: android iphone html5 google-chrome firefox

我有一个iphone浏览器,我正在测试HTML 5验证。我正在使用safari和Firefox,它们都不会验证我的表单输入。我已经在我的电脑上使用Firefox和Chrome进行了测试,但它确实有效。

iPhone和Android浏览器是否支持此功能?

<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>Insert title here</title>
</head>
<body>
<form>
    <input name='test1' type='text' placehoder='Test 1' required maxlength='32' pattern='^[0-9\w\s]+'></input>
    <input type='submit' name='Submit' value='Submit'/>
</form>
</body>
</html>

1 个答案:

答案 0 :(得分:1)

&#34; Android,Safari和Mobile Safari支持pattern属性,但不支持表单验证,因此不会阻止提交错误的值。&#34;

http://www.wufoo.com/html5/attributes/10-pattern.html

它适用于Firefox,请参阅pattern属性的规范:

http://www.w3schools.com/tags/att_input_pattern.asp