I need to reset the values of the input radio in my view , via Ajax
the view has the following generated html
<input checked="checked" class="" id="user_membership_selection_1"
name="user[membership_selection]" type="radio" value="1" />Selected
Membership</p>
<input id="user_membership_selection_2"
name="user[membership_selection]" type="radio" value="2" />
Selected Membership</p>
fin my controller method , I get other values to replace the radio
values "1" => "11" and "2" by "22"
I can get easily the values like that
alert( $
('input:radio[name="user[membership_selection]"]:checked').val() );
but I cannot change it.. I thought I could access them like that
alert( $('input:radio[name="user[membership_selection]"]
[0]').val() );
alert( $('input:radio[name="user[membership_selection]"]
[1]').val() );
and reset the value
$('input:radio[name="user[membership_selection]"][0]').val( "11")
$('input:radio[name="user[membership_selection]"][1]').val( "22")
as $('input:radio[name="user[membership_selection]"]') should returned
an array with the 2 elements ..
but it's wrong ... 'undefined'
any clue ??
--
You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group.
To post to this group, send email to rubyonrails-talk@googlegroups.com.
To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
No comments:
Post a Comment