jQuery通过与IE7/IE8兼容的方式在IE10上进行必需的验证来验证错误 [英] jQuery validate bug with required validation on IE10 in compatibility mode to IE7/IE8

查看:147
本文介绍了jQuery通过与IE7/IE8兼容的方式在IE10上进行必需的验证来验证错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有一个

there is a Confirmed bug in IE10 compatibility mode that won't be fixed for IE10:

在IE10中与IE8兼容
$ element.get(0).getAttribute("required")在缺少必需属性时返回",这将导致需要所有字段

In IE10 in compatibility to IE8
$element.get(0).getAttribute("required") returns "" when the required attribute is missing, this causes ALL fields to be required

在IE10中与IE7兼容
$ element.get(0).getAttribute("required")在所有情况下均返回null.
因此您不能将required用作元素

In IE10 in compatibility to IE7
$element.get(0).getAttribute("required") returns null in all cases.
so you can't use required as an attribute on the element

插件作者不打算处理兼容性视图,因为用户不应该遇到兼容性视图,但是只想检查旧IE中某些内容的开发人员可能想要

The plugin Author doesn't plan to handle compatibility views as users shouldn't encounter it, but developers that just want to check something in old IE might want to

推荐答案

在IE10中与IE8兼容
如果缺少必需的属性,则element.attributes ["required"]为空

In IE10 in compatibility to IE8
element.attributes["required"] is null if the required attribute is missing

在IE10中与IE7兼容
如果存在必需属性,则element.attributes ["required"].value返回"-1",否则返回"null"

In IE10 in compatibility to IE7
element.attributes["required"].value returns "-1" if required attribute exists and "null" otherwise

因此将我的叉子更新为jQuery validate插件以进行此修复 这里的所有细节 https://github.com/avipinto/jquery-validation/commit/a22d4c37c3047199bf17a4943e3be352d

so updated my fork to the jQuery validate plugin for this fix all details here https://github.com/avipinto/jquery-validation/commit/a22d4c37c3047199bf17a4943e3be352d88d8158

这篇关于jQuery通过与IE7/IE8兼容的方式在IE10上进行必需的验证来验证错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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