:invalid and :required CSS pseudo-classes don't work with jQuery traversing methods when selector matches multiple form elements
问题 HTML <input required> <input required> <input required> JavaScript /* // Add script for noted :invalid check to work // :required can also be made to work by modifying script, i.e. changing "invalid" to "required" where noted // Source: http://stackoverflow.com/a/15821264/2171842 jQuery.extend(jQuery.expr[':'], { invalid : function(elem, index, match){ // modify pseudo-class here var invalids = document.querySelectorAll(':invalid'), // modify pseudo-class here result = false, len = invalids