Resetting input radio value in my .js.erb

I need to reset the values of the input radio in my view , via Ajax

the view has the following generated html
Selected
Membership



Selected Membership

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