JSFiddle - React, Tailwind, and code Playground
HTML
Total
<input type="text" id="count" value="$0" readonly />
<div>
<h4>Contact plugin</h4>
<input type="radio" name="pak1" class="mnozstvi_sleva" value="4
Qty" onClick="changeTotal(0, this.name)">No
<br>
<input type="radio" class="mnozstvi_sleva" onclick="changeTotal(5, this.name)" value="2
Qty" name="PAk1">Yes!
<h4> Mailing list</h4>
<input type="radio" class="mnozstvi_sleva" onclick="changeTotal(0, this.name)" value="2
Qty" name="PAk21">No
<input type="radio" class="mnozstvi_sleva" onclick="changeTotal(10, this.name)" value="2
Qty" name="PAk21">Yes</div>
<hr>
<div>
<h4>Contact plugin</h4>
<input type="radio" name="pak3" class="mnozstvi_sleva" value="4
Qty" onClick="changeTotal(0, this.name)">No
<br>
<input type="radio" class="mnozstvi_sleva" onclick="changeTotal(5, this.name)" value="2
Qty" name="PAk3">Yes!
<h4> Mailing list</h4>
<input type="radio" class="mnozstvi_sleva" onclick="changeTotal(0, this.name)" value="2
Qty" name="PAk31">No
<input type="radio" class="mnozstvi_sleva" onclick="changeTotal(10, this.name)" value="2
Qty" name="PAk31">Yes</div>
JavaScript
var groups = {};
function changeTotal(value, group) {
groups[group.toLowerCase()] = value;
var sum = 0;
Object.keys(groups).forEach(function (key) {
sum += groups[key]
});
document.getElementById('count').value = "$"+(10 * sum);
}