title: Calculate the total of form immediately without having to check a checkbox
body: <p>I have an HTML, JavaScript form, which calculates a price based upon choices made in the form. The problem is that the total price will only be calculated after one checkbox has been clicked. I want it to calculate the price immediately without having to check a checkbox first. Below is a snippet of the JavaScript code: </p>
  
  <pre><code>function totalIt() {
    var input = document.getElementsByName("product");
    var total = 0;
    for (var i = 0; i &lt; input.length; i++) {
      if (input[i].checked) {
          total += parseFloat(input[i].value); // this function should run immediately
      }
    }
    document.getElementById("total").value = "€" + total.toFixed(2);
  }
  </code></pre>
  
  <p>The full form can be found <a href="https://codepen.io/anon/pen/XRMGgx" rel="nofollow noreferrer">here</a>.</p>
  
  <p>How can this be done?</p>