diff --git a/changelog.txt b/changelog.txt index c0fdd7b..e8ccba1 100644 --- a/changelog.txt +++ b/changelog.txt @@ -10,6 +10,7 @@ * Improved interactive select validation, now validating also on click (via option or select, inconsistent across browsers); doesn't work in Safari, which doesn't trigger a click event at all on select elements; fixes http://plugins.jquery.com/node/11520 * Updated to latest form plugin (2.36), fixing http://plugins.jquery.com/node/11487 * Bind to blur event for equalTo target to revalidate when that target changes, fixes http://plugins.jquery.com/node/11450 +* Simplified select validation, delegating to jQuery's val() method to get the select value; should fix http://plugins.jquery.com/node/11239 1.5.5 --- diff --git a/jquery.validate.js b/jquery.validate.js index 11505db..ee41b47 100644 --- a/jquery.validate.js +++ b/jquery.validate.js @@ -889,8 +889,9 @@ $.extend($.validator, { return "dependency-mismatch"; switch( element.nodeName.toLowerCase() ) { case 'select': - var options = $("option:selected", element); - return options.length > 0 && ( element.type == "select-multiple" || ($.browser.msie && !(options[0].attributes['value'].specified) ? options[0].text : options[0].value).length > 0); + // could be an array for select-multiple or a string, both are fine this way + var val = $(element).val(); + return val && val.length > 0; case 'input': if ( this.checkable(element) ) return this.getLength(value, element) > 0;