在 html5 中,有标签“required”用于输入,
例如:<input type="text" required="required" value="" />
但它适用于 Firefox、Opera 和 Chrome,但不适用于 IE 和 Safari,我试图包括 <script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
, 但它仍然无法正常工作!
最佳答案
如his comments中提到的爆丸, required
form attribute is not supported by Safari or versions of Internet Explorer lower than 10 .
您可以通过使用第三方 JavaScript 插件来解决这个问题,该插件将强制执行表单验证,而不管浏览器版本如何。参见 https://github.com/dilvie/h5Validate .
关于html - 将 html5 标签 "required"应用于每个浏览器,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/16289129/