title: Calculate sum of values on text-boxes based on checkbox checked
body: <p>I want to add total sum in the text boxes based on the checkbox checked. But my text-box values varies dynamically based on the user choice, how to solve this?</p>
  
  <pre><code>function UpdateCost() {
    var sum = 0;
    var gn, elem;
    for (i=0; i&lt;5; i++) {
      gn = 'game'+i;
   elem = document.getElementById(gn);
    if (elem.checked == true) { sum += Number(elem.value); }
   }
   document.getElementById('totalcost').value = sum.toFixed(2);
  } 
  
  &lt;html&gt;
  
  &lt;input type="checkbox" id='game0' value="9.99"  onclick="UpdateCost()"&gt;Game 1 ( 9.99)&lt;br&gt;
  &lt;input type="checkbox" id='game1' value="19.99" onclick="UpdateCost()"&gt;Game 2 (19.99)&lt;br&gt;
  &lt;input type="checkbox" id='game2' value="27.50" onclick="UpdateCost()"&gt;Game 3 (27.50)&lt;br&gt;
  &lt;input type="text" id="totalcost" value=""&gt;
  </code></pre>
  
  <p></p>
  
  <p>The problem is the third value changes based on the other dropdown list</p>
  
  <p>i have done something to generate the result of third but could not bind that value to checkbox value dynamically. here is the code below</p>
  
  <pre><code>&lt;select ng-model="num1" ng-init="1"&gt;
   &lt;option selected ="selected" value="1"&gt;1
  &lt;option value="2"&gt;2
   &lt;option value="3"&gt;3
  &lt;/select&gt;
  
  &lt;input type="number" id="txt2" value="{{num1*1000}}" readonly="true"&gt;
  </code></pre>