JSFiddle - React, Tailwind, and code Playground

HTML

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
<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>

JavaScript

$('#button').click(function() {
var total = 0;
          $('input:checkbox:checked').each(function(){ // iterate through each checked element.
            total += isNaN(parseInt($(this).val())) ? 0 : parseInt($(this).val());
          }); 
          
          alert(total);
});