aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorjeresig <jeresig@gmail.com>2009-12-22 01:28:37 -0500
committerjeresig <jeresig@gmail.com>2009-12-22 01:28:37 -0500
commit1b67aaee74c9b683ac31893b40077abd62e6d8c6 (patch)
treeb71d180e0e9022fa982656239156984b4d8ffdf9
parentf298cce100c6fe23840ac95e66aaea9cb2bfb447 (diff)
downloadjquery-1b67aaee74c9b683ac31893b40077abd62e6d8c6.tar.gz
jquery-1b67aaee74c9b683ac31893b40077abd62e6d8c6.zip
Make sure that the correct value is retreived for options that have no value specified, in IE 6. Continues to fix #5697.
-rw-r--r--src/attributes.js4
1 files changed, 3 insertions, 1 deletions
diff --git a/src/attributes.js b/src/attributes.js
index eecf90fa9..663d660f4 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 ) {