I created this as a ticket (http://dev.jquery.com/ticket/3609) and
attached a patch, but since I've presumed the intended behavior I
thought I should pose this to the mailing list.

The documentation of val() says, in the second section for val(val):

"Checks, or selects, all the radio buttons, checkboxes, and select
options that match the set of values."

And the example code shows that it works given a single non-Array
value to select the option on a non-multiple select:

$("#single").val("Single2");

But this does not work for radio or checkbox inputs. Given this HTML:

<input type="radio" name="ordinal" value="1">First</input>
<input type="radio" name="ordinal" value="2">Second</input>

code like this:

$("[EMAIL PROTECTED]'ordinal']").val("2");

surprisingly ends up setting the "value" attribute of all the radio
buttons to "2" like this:

<input type="radio" name="ordinal" value="2">First</input>
<input type="radio" name="ordinal" value="2">Second</input>

instead of setting the "checked" attribute on the radio button with
value "2" as expected, like this:

<input type="radio" name="ordinal" value="1">First</input>
<input type="radio" name="ordinal" value="2" checked>Second</input>

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to