Jquery – Capturing RadioButton click and taking action

jquery

I have 3 radiobutton on my page. There are 3 buttons also on the same page. i want to show different buttons when each is clicked.

<input id="Radio1" type="radio" name="grp1" class="abc" />
<input id="Radio2" type="radio" name="grp1" class="abc" />
<input id="Radio3" type="radio" name="grp1" class="abc" />

Update: There is only one button to be shown corresponding to each radio button..For eg: If Radio1 is clicked show Button 1, if Radio 2 is clicked show Button 2 and so on

Best Answer

$(function() { // at dom ready
  $('input.abc').change(function() { // on radio's change event
    $('.buttons-to-hide-class').hide(); // hide buttons
    $('#button-to-show-id').show(); // show desired button
  });
});
Related Topic