JSFiddle - React, Tailwind, and code Playground
HTML
Yes
<input class="calc" type="radio" name="radio1" value="10" />
No
<input class="calc" type="radio" name="radio1" value="0" /><br />
Yes
<input class="calc" type="radio" name="radio2" value="10" />
No
<input class="calc" type="radio" name="radio2" value="0" /><br />
Yes
<input class="calc" type="radio" name="radio3" value="10" />
No
<input class="calc" type="radio" name="radio3" value="0" /><br />
Total Score:
<input type="text" name="sum" />
JavaScript
function calcscore(){
var score = 0;
$(".calc:checked").each(function(){
score+=parseInt($(this).val(),10);
});
$("input[name=sum]").val(score)
}
$().ready(function(){
$(".calc").change(function(){
calcscore()
});
});