Well, it's intentional in that the code explicitly checks .text and .value:
this.selected = (jQuery.inArray( this.value, values ) >= 0 ||
jQuery.inArray( this.text, values ) >= 0);
Although, I'm torn as to if your specific case warrants more merit. It seems
odd to me to have a value be identical to a different text value (which why
it probably hasn't come up before). Perhaps you can expand on the specific
case where this came up?
--John
On Thu, Jul 23, 2009 at 11:18 AM, Ethan Poole <[email protected]> wrote:
>
> I've encountered an issue/bug with jQuery and how it handles <select>
> when setting the value using .val(). I have an <option> with text
> "foo" and value "foo" and another <option> with text "foo" and value
> "foo2". When I do $('...').val('foo') it selects the second option
> that has the value "foo2".
>
> I've created a test page to demonstrate the problem:
> http://ethanpoole.com/tests/jquery/select-value
>
> Since I wasn't sure if this is intended or an error, I figured I'd
> post it on the mailing list first.
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"jQuery Development" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/jquery-dev?hl=en
-~----------~----~----~----~------~----~------~--~---