title: how do I sum some input fields value (plus multiply is value by an attribute representing price)
body: <p>I have a form where people enter quantities they want from a list of products. Each input value represent the amount they want and the attribute data-price stores the price of the product.</p>
  
  <p>I am using this jquery code to sum put the fields values</p>
  
  <pre><code>   $(document).ready(function(){
  
          //iterate through each textboxes and add keyup
          //handler to trigger sum event
          $(".number.qty_input").each(function() {
  
              $(this).keyup(function(){
                  calculateSum();
              });
          });
  
      });
  
      function calculateSum() {
  
          var sum = 0;
          //iterate through each textboxes and add the values
          $(".number.qty_input").each(function() {
  
              //add only if the value is number
              if(!isNaN(this.value) &amp;&amp; this.value.length!=0) {
                  sum += parseFloat(this.value);
              }
  
          });
          //.toFixed() method will roundoff the final sum to 2 decimal places
          $("#the_price_v_m").html(sum.toFixed(2));
      }
  </code></pre>
  
  <p>Now I need to customize it so that It allows me to multiply field value by attribute data-price each one of them has. I have already tried a few unsuccessfull methods and I wonder if I could get some help on this.</p>
  
  <p>Thanks!</p>
  
  <p>oh by the way the html I use is </p>
  
  <pre><code>&lt;input type="text" class="number qty_input valid" data-price="15"&gt;
  &lt;input type="text" class="number qty_input valid" data-price="15"&gt;
  &lt;input type="text" class="number qty_input valid" data-price="15"&gt;
  &lt;input type="text" class="number qty_input valid" data-price="15"&gt;
  &lt;input type="text" class="number qty_input valid" data-price="15"&gt;
  </code></pre>