我在 Opera 和 Safari 上遇到 HTML5 验证问题。
在 Opera 中,消息气泡不显示任何文本,而在 Safari 中,当我按下提交按钮时不会进行验证。在 IE、Mozilla 或 Chrome 中,验证工作正常。谁能告诉我为什么会这样?
我在表单中的输入具有 html5 标准验证,具有必需的属性,仅此而已。
我试图在网上搜索这个主题,但没有找到。
请帮帮我。
谢谢
<form class="sign-in-form" action="" method="post">
<li>
<label>
<span>Username</span>
<input placeholder="Please enter your username" name="username" type="text" tabindex="1" title="It must contain the username that you have chosen at registration" required autofocus>
</label>
</li>
<li>
<label>
<span>Password</span>
<input placeholder="Please enter your password" name="password" type="password" tabindex="2" title="It must contain the password that you have chosen at registration" required>
</label>
</li>
<li>
<button name="sign-in-btn" type="submit" id="sign-in-submit">Sign In</button>
</li>
</form>
最佳答案
这是 Opera 中的一个奇怪错误:使用 @font-face 网络字体时不显示消息。我也遇到过这个问题。选择像 Arial 这样的普通字体,就会显示消息。 Safari 不支持 html5 验证(safari 有部分支持,但没有验证气泡)。我的提示是:使用 webshims lib ( http://afarkas.github.io/webshim/demos/ ) - 用于验证等许多功能的出色 polyfill。
关于使用 Opera 和 Safari 进行 HTML5 验证,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16251987/