JSFiddle - React, Tailwind, and code Playground

by Joe

HTML

<div class="section">
  <input type="number" name="q1"/>
  <input type="number" name="q2"/>
  <input type="number" name="q3"/>
  <input type="number" name="q4"/>
</div>

JavaScript

$('.section').each(function(){
  var totalPoints = 0;
  $(this).find('input').each(function(){
    totalPoints += parseInt($(this).val());
  });
  alert(totalPoints);
});