Using .val() with <select>

Using .val() with <select>


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.