for ( var i = one ? index : 0, max = one ? index + 1 : options.length; i < max; i++ ) {
var option = options[ i ];
- if ( option.selected ) {
- // Get the specifc value for the option
+ // Don't return options that are disabled or in a disabled optgroup
+ if ( option.selected && !option.disabled &&
+ (!option.parentNode.disabled || !jQuery.nodeName( option.parentNode, "optgroup" )) ) {
+ // Get the specific value for the option
value = jQuery(option).val();
// We don't need an array for one selects