X-Git-Url: http://git.asbjorn.it/?a=blobdiff_plain;ds=sidebyside;f=src%2Fattributes.js;h=663d660f4245433ac4d69606e15b3e600ff63730;hb=1b67aaee74c9b683ac31893b40077abd62e6d8c6;hp=91a0fe176b7b95e89ddc48fcea5fe2e31bb1e25a;hpb=261b7efb5f86a5c9a3de8434f3cad858101e4249;p=jquery.git diff --git a/src/attributes.js b/src/attributes.js index 91a0fe1..663d660 100644 --- a/src/attributes.js +++ b/src/attributes.js @@ -158,13 +158,15 @@ jQuery.fn.extend({ } if ( jQuery.isArray(val) && /radio|checkbox/.test( this.type ) ) { - this.checked = jQuery.inArray(this.value || this.name, val) >= 0; + this.checked = jQuery.inArray( this.value, val ) >= 0; } else if ( jQuery.nodeName( this, "select" ) ) { var values = jQuery.makeArray(val); jQuery( "option", this ).each(function() { - this.selected = jQuery.inArray( this.value, values ) >= 0; + // IE 6 will return "" for the value if one isn't specified, instead of the text + var node = this.getAttributeNode("value"); + this.selected = jQuery.inArray( node && node.specified ? node.value : this.value || this.text, values ) >= 0; }); if ( !values.length ) {