]> source.dussan.org Git - jquery.git/commitdiff
Make sure that the correct value is retreived for options that have no value specifie...
authorjeresig <jeresig@gmail.com>
Tue, 22 Dec 2009 06:28:37 +0000 (01:28 -0500)
committerjeresig <jeresig@gmail.com>
Tue, 22 Dec 2009 06:28:37 +0000 (01:28 -0500)
src/attributes.js

index eecf90fa90024f2c018b0e597331069ffbadbe55..663d660f4245433ac4d69606e15b3e600ff63730 100644 (file)
@@ -164,7 +164,9 @@ jQuery.fn.extend({
                                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 ) {