title: update value of a div with plus-minus buttons
body: <p>I have this function :</p>
  
  <pre><code>    $("#inc&lt;?php echo"$key"; ?&gt;").click(function(){
  
      prod_id = "&lt;?php echo"$key"; ?&gt;";
      $.ajax({
      type: "POST",
      url: "updateproduct2cart.php",
      data: "itemid="+prod_id+"&amp;act=update&amp;qty=up"
      });
  
      var currentValue = $("#inc&lt;?php echo"$key"; ?&gt;").closest('#SCprodsB').next('#SCprodsF').find('#totalCommande').html();
      currentValue = parseFloat(currentValue);
  
      $(":text[name='qty&lt;?php echo"$key"; ?&gt;']").val(Number($(":text[name='qty&lt;?php echo"$key"; ?&gt;']").val()) + 1);
  
      var totalItems = parseFloat($("#qty&lt;?php echo"$key"; ?&gt;").val());
      var priceItem = parseFloat(&lt;?php echo"$priceProduct"; ?&gt;).toFixed(2);
      var totalValueUp = parseFloat(priceItem * totalItems).toFixed(2);
      $("#subtotal&lt;?php echo"$key"; ?&gt;").html("&amp;#128; "+ totalValueUp);
  
      /* PART BELOW IS NOT WORKING PROPERLY*/
  
      var numItems = parseFloat($(":text[name='qty&lt;?php echo"$key"; ?&gt;']").val());
      var totalPriceItems = parseFloat(priceItem * numItems).toFixed(2);
      var newValue = parseFloat(currentValue + totalPriceItems).toFixed(2);
      $("#inc&lt;?php echo"$key"; ?&gt;").closest('#SCprodsB').next('#SCprodsF').find('#totalCommande').html(newValue);
  
      });
  </code></pre>
  
  <p>And this is the HTML part :</p>
  
  <pre><code>&lt;table id="SCproduits" summary="commande"&gt;
      &lt;caption&gt;&lt;/caption&gt;
      &lt;thead&gt;
          &lt;tr&gt;
              &lt;th scope="col"&gt;--&lt;/th&gt;
              &lt;th scope="col"&gt;--&lt;/th&gt;
              &lt;th scope="col"&gt;--&lt;/th&gt;
              &lt;th scope="col"&gt;--&lt;/th&gt;
              &lt;th scope="col"&gt;--&lt;/th&gt;
              &lt;th scope="col"&gt;--&lt;/th&gt;
              &lt;th scope="col"&gt;--&lt;/th&gt;
              &lt;th scope="col"&gt;--&lt;/th&gt;
          &lt;/tr&gt;
      &lt;/thead&gt;
      &lt;tbody id="SCprodsB"&gt;
          &lt;tr id="prodItemi3" name="prodItemi3"&gt;
              &lt;tr id="prodItemi4" name="prodItemi4"&gt;
                  &lt;th id="prodItemi4" scope="row"&gt;xxxxxxxxx&lt;/th&gt;
                  &lt;td&gt;xxx&lt;/td&gt;
                  &lt;td&gt;
                      &lt;td&gt;
                          &lt;button id="deci4" class="SCbutton"&gt;-&lt;/button&gt;
                          &lt;input id="qtyi4" class="SCinput3" type="text" size="2" value="1"
                          name="qtyi4"&gt;
                          &lt;button id="inci4" class="SCbutton"&gt;+&lt;/button&gt;
                      &lt;/td&gt;
                      &lt;td&gt;
                          &lt;td&gt;
                              &lt;td&gt;
                                  &lt;td&gt;
              &lt;/tr&gt;
      &lt;/tbody&gt;
      &lt;tfoot id="SCprodsF"&gt;
          &lt;tr&gt;
              &lt;th scope="row"&gt;&lt;/th&gt;
              &lt;td colspan="7"&gt;€ &lt;span id="totalCommande"&gt;xxx&lt;/span&gt;
  
              &lt;/td&gt;
          &lt;/tr&gt;
      &lt;/tfoot&gt;
  &lt;/table&gt;
  </code></pre>
  
  <p>I can't get the (span id="totalCommande") to be updated with the correct total value when using the (inci4 button). Any idea ? Am I going the wrong way ? Thanks</p>