Вопрос

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

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

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

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

Это было полезно?

Решение

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

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

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

Другие советы

I changed mine to call

$element.get(0).hasAttribute("required")

before checking the value with getAttribute()

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top