Hi i want to get radiobutton value using jquery. This is the radiobutton code. The period[count] naming is because the radiobutton is loop in array using javascript
<input type='radio' name='period["+count+"]' value='1' checked/>Full<input type='radio' name='period["+count+"]' value='0.5'/>Half (AM)<input type='radio' name='period["+count+"]' value='0.5'/>Half (PM)
Question is how do i get the total value of the checked radio button?I try this code but it give only the first value of checked radio button
var values2 = $("input:radio[name='period[2]']").val();
var values3 = $("input:radio[name='period[3]']").val();
Edited
This is the code to solve this problem thanks to Aaron Saunders
var x = 0;
$("input:radio[name^='period']:checked").each(function(){
x = x + parseFloat($(this).val());
});
find all that start with period, then add them up