From 1b67aaee74c9b683ac31893b40077abd62e6d8c6 Mon Sep 17 00:00:00 2001 From: jeresig Date: Tue, 22 Dec 2009 01:28:37 -0500 Subject: [PATCH] Make sure that the correct value is retreived for options that have no value specified, in IE 6. Continues to fix #5697. --- src/attributes.js | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/attributes.js b/src/attributes.js index eecf90fa90..663d660f42 100644 --- a/src/attributes.js +++ b/src/attributes.js @@ -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 ) {