I want to loop through radio button values and add them up for a quiz. My question is how to call a variable for "name" inside this statement:
answer = $("input[type='radio'][name='q1']:checked");
I need to increment q1 by 1 in my loop. I thought I could use my variable q for this, just not sure how to stick it in there:
for (var j=1; j < 11; j++)
{
q="q"+j;
answer = $("input[type='radio'][name='q1']:checked");
answer = answer.val();
answer = Number(answer);
total = total + answer;
}