Hi, I have found a bug in the jQuery.val() function. When you are trying to set the value of a select to a particular value, jQuery goes through all of the options in the list and checks their value and text properties for the passed value, checking the matched item. In jQuery 1.4, this looks like it has been optimized from the following in jQuery 1.3.2 on line 471:
this.selected = (jQuery.inArray( this.value, values ) >= 0 || jQuery.inArray( this.text, values ) >= 0); to the following in jQuery 1.4: this.selected = jQuery.inArray( this.value || this.text, values ) >= 0; This does a single lookup which is great but you get very different results. For example, I might have an option with a different value property than the display text. For example: <option value="lbs">pounds</option> In jQuery 1.3 I could set the selected option with either: $("select").val("lbs"); or: $("select").val("pounds"); However jQuery 1.4 used the first found property (value or text) and doesn't search both. So using my example, the following would work: $("select").val("lbs"); but not: $("select").val("pounds"); because both properties are found, and only the first one is searched. I can see why this optimization was done, but I think that this will cause problems for a lot of people! Devon -- You received this message because you are subscribed to the Google Groups "jQuery Development" group. To post to this group, send email to jquery-...@googlegroups.com. To unsubscribe from this group, send email to jquery-dev+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/jquery-dev?hl=en.