* Simplified select validation, delegating to jQuery's val() method to get the select value; should fix http://plugins.jquery.com/node/11239

This commit is contained in:
Jörn Zaeffferer
2009-11-23 22:20:29 +00:00
parent d98ab2d886
commit d35485a378
2 changed files with 4 additions and 2 deletions

5
jquery.validate.js vendored
View File

@@ -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;