JSFiddle - React, Tailwind, and code Playground

HTML

<form>
    <input type="radio" class="count" name="test[]" value="1" />Test 1
    <input type="radio" class="count" name="test[]" value="3" />Test 2
    <input type="radio" class="count" name="test[]" value="3" />Test 3
    <input type="radio" class="count" name="test[]" value="5" />Test 4
    <input type="radio" class="count" name="test[]" value="9" />Test 5
</form>
<span id="countMe">0</span>

JavaScript

var counter = 0;
var addMe = 0;
$(".count").click(function() {
    if ($(this).attr("checked") != "checked"){
        addMe = parseInt($(this).val());
        counter += addMe;
        $("#countMe").html(counter);
        
    }
    else {
        $("#countMe").html(counter - 1);
    }
});