一个表单具有禁用验证的可能性。
现在,我有一个不在表单中的HTML5元素。在这种情况下如何禁用验证?
<form novalidate/>
现在,我有一个不在表单中的HTML5元素。在这种情况下如何禁用验证?
<noform>
<input name="email" type="email"/>
</noform>
<form novalidate/>
<noform>
<input name="email" type="email"/>
</noform>
你想要实现什么并不明确。如果input
元素不能提交到服务器,则不会触发验证过程,正如你的评论所指出的那样。然而,单个input
元素仍然可能处于无效状态。有几种简单的解决方案可以避免这种情况:
type =“email”
email
类型,但不关心它是否为有效电子邮件(例如,触发移动设备上特定键盘模式),则使用CSS隐藏指示。以下是如何隐藏常规Firefox红色光晕:
input:-moz-ui-invalid {
box-shadow: none;
}
这里是一个快速的例子链接