In IE 7-9, HTML5 required attribute has problems

See this minimal test case for an example of the following problems:

https://github.com/jzaefferer/jquery-validation/issues/301

 

  • IE 10: works fine.
  • IE 9: the required attribute doesn’t trigger validation of a field.
  • IE 7 & 8: the required attribute appears to prevent validation of a field.

I first noticed these issues while using the validation plugin with jQuery 1.6.4, but they still seem to happen with 1.7.1 as well.

I’ve found that I can work around this issue by adding the following code before invoking the plugin:

if ($.browser.msie && $.browser.version < 10) { $('#form_to_validate [required]').addClass('required').removeAttr('required'); }

Leave a comment