JSFiddle - React, Tailwind, and code Playground
HTML
<!DOCTYPE html>
<html>
<head>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.3.1/jquery.min.js"></script>
</head>
<body>
<div class="container">
<input type="checkbox" classname="check" id="one" value="1"> 1 <br>
<input type="checkbox" classname="check" id="two" value="2"> 2 <br>
<input type="checkbox" classname="check" id="three" value="3"> 3 <br>
<input type="checkbox" classname="check" id="four" value="4"> 4 <br>
<input type="checkbox" classname="check" id="five" value="5"> 5 <br>
<button type="button" id="button"> Add </button><br>
<p id="total"></p>
</div>
</body>
</html>
JavaScript
var addButton = document.getElementById("button");
var totalP = document.getElementById("total");
addButton.onclick = function(){
var total =0;
$.each($("input[classname='check']:checked"), function(){
total = total + Number($(this).val());
});
totalP.innerText = "total value "+ total;
}