Skip to content Skip to sidebar Skip to footer

Jquery Sync Selected Radio Button Between 2 Radio Button Groups

I know it can be done with input boxes using keyup paste on JQuery but what about Radio buttons? Example: User Selects option from Area A (radio button) and it selects(syncs) area

Solution 1:

$('input[name=radio_A]').change(function() {
    var index = $(this).index('input[name=radio_A]');
    $('input[name=radio_B]:eq(' + index + ')').attr('checked','checked');
});

Code: http://jsfiddle.net/BUbHf/1/

Solution 2:

Try this:

$("#radio_A").click(function() {
    $("#radio_B").attr("checked", $(this).attr("checked"));
});
$("#radio_A2").click(function() {
    $("#radio_B2").attr("checked", $(this).attr("checked"));
});

Example fiddle

Solution 3:

$("input[name='radioGroup1'][value='"+$("input[name='radioGroup2']:checked").val()+"']").prop("checked",true);

Post a Comment for "Jquery Sync Selected Radio Button Between 2 Radio Button Groups"