JSFiddle - React, Tailwind, and code Playground
HTML
<div id="dermal">
<p><input type="checkbox" value="Crows feet" rel="15">Crows feet</p>
<p><input type="checkbox" value="Frown lines" rel="15">Frown lines</p>
<p><input type="checkbox" value="Individual facial line" rel="15">Individual facial line</p>
</div>
<div id="wrinkle">
<p><input type="checkbox" value="Wrinkle1" rel="30">Crows feet</p>
<p><input type="checkbox" value="Wrinkle2" rel="15">Frown lines</p>
</div>
<span id="output"></span>
<br>
<span id="chto"></span>
JavaScript
$(document).ready(function() {
function recalculate() {
var sum = 0;
$("input[type=checkbox]:checked").each(function() {
//chto += parseInt($(this).val());
chto = $(this).val();
sum += parseInt($(this).attr("rel"));
});
$("#output").html(sum);
$("#chto").html(chto);
}
$("input[type=checkbox]").change(function() {
recalculate();
});
});