title: How to update value based on other input box dynamically using jQuery?
body: <p>I'm trying to make a shopping cart.</p>
  
  <p>Where I have list of products which has different price.</p>
  
  <p>Now when i tried to change the quantity the price should change based on quantity as well as the total one.</p>
  
  <p>But the problem i'm facing is using the below code when i tried to change the quantity, price get updated but the others also get updated as well though i didn't change the Quantity.</p>
  
  <p>Then total one doesn't show the appropriate total</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-js lang-js prettyprint-override"><code>$(".quantity").change(update);
  
  function update() {
    $(".quantity").each(function() {
      var qty = Number($(this).val());
      var net = document.getElementById("net_price").value;
      var total = qty * net;
      $('.total').html("$" + total);
      $(".grandTotal").text(calculateSum());
    });
  
    function calculateSum() {
      var sum = 0;
      $(".total").each(function() {
        var value = $(this).val();
        if (!isNaN(value) &amp;&amp; value.length != 0) {
          sum += parseFloat(value);
        }
      });
      return sum;
    }
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"&gt;&lt;/script&gt;
  &lt;table&gt;
  &lt;tr&gt;
  &lt;td class="qty table-default"&gt;
    &lt;input type="number" class="quantity" value="" name="qty" maxlength="3" max="999" min="1" /&gt;&lt;/td&gt;
  &lt;td class="total_price table-default total"&gt;&lt;/td&gt;
  &lt;td&gt;&lt;input type="hidden" id="net_price" value=""&gt;45&lt;/td&gt;
  &lt;td class="grandTotal"&gt;&lt;/td&gt;
  &lt;/tr&gt;
  &lt;/table&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>Anyone please help me to find the soultion</p>