I have a form that looks like this
Right now, the problem I am having is that the user can select more than 1 radio button. They should only be able to select 1. I have a Javascript function that will go through all the rows and disable the button that was not selected as seen here.
function disableNonSelectedRadioButtons(selectedRadioButton) {
$('#payer-contract-global-table .clone-target').each(function (i) {
var radioName = 'radio' + '-c' + i;
if (selectedRadioButton != radioName)
$('#' + radioName).prop("checked", false);
});
}
This works. But I need to send the correct selectedRadioButton
to this function. How can I correctly do that in Javascript?
Currently the HAML looks like this:
%input.radio-button{:name => "radio-c#{index}", :type => "radio", :id => "radio-c#{index}", :checked => "true"}
Is there some type of code in Javascript that I can do that says that
if I click button for radio-c2
it will send that to my function?