title: Why is this HTML table calculation not showing the total?
body: <p>Just started diving into JS and Jquery and I can't find out why this is not calculating the table's qty by price when the function is called without any parameter passed.</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>function add_to_total(el) {
    if (el) {
      var parent = $(el).closest('tr');
      var price = parent.find('.price').val();
      var qty = parent.find('.qty').val();
      if (price == '' || qty == '') {
        alert('Please make sure that the price and metros are informed correctly.');
        return;
      }
      var total = (price * qty);
      total = total.toFixed(2);
      parent.find('.total_price').html("$" + total);
    } else {
  
  
  //THIS IS THE PIECE THAT DOESN'T SEEM TO RUN
      $("#tableRows tr").each(function() {
        $(this).find('.total_price').val(parseFloat($(this).find('.qty').val()) * parseFloat($(this).find('.price').val()));
      });
      console.log('Row Total: ' + $(this).find('.total_price').val(parseFloat($(this).find('.qty').val()) * parseFloat($(this).find('.price').val())))
    }
  
    var gridTotal = 0;
    $(".total_price").each(function(index, item) {
      var val = parseFloat($(this).html().replace(/[$,]/g, ''));
      if (isNaN(val)) val = 0;
      gridTotal += val;
    });
    $('.total').html('$' + gridTotal.toFixed(2));
  }</code></pre>
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;table class="table table-hover table-vcenter" id="dtable"&gt;
    &lt;thead&gt;
      &lt;tr&gt;
        &lt;th style="width:7%"&gt;Precio/m (COP)&lt;/th&gt;
        &lt;th style="width:8%"&gt;Metros (m)&lt;/th&gt;
        &lt;th style="width:10%"&gt;Precio Total sin IVA&lt;/th&gt;
      &lt;/tr&gt;
    &lt;/thead&gt;
    &lt;tbody id="tableRows"&gt;
      &lt;tr&gt;
        &lt;td&gt;&lt;input type="number" step="0.01" min="0" class="price" name="numberInputs" value="3.91" onchange="add_to_total(this)"&gt;&lt;/td&gt;
        &lt;td&gt;&lt;input type="number" min="0" class="qty" name="numberInputs" value="124" onchange="add_to_total(this)"&gt;&lt;/td&gt;
        &lt;td class="total_price"&gt;&lt;strong&gt;$0.00&lt;/strong&gt;&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tbody&gt;
    &lt;tfoot&gt;
      &lt;tr&gt;
        &lt;td id="totalTitle" colspan="8" align="right"&gt;&lt;strong&gt;Total:&lt;/strong&gt;&lt;/td&gt;
        &lt;td id="totalValue" class="total"&gt;$0.00&lt;/td&gt;
      &lt;/tr&gt;
    &lt;/tfoot&gt;
  &lt;/table&gt;
  &lt;script&gt;
  //add_to_total()
  &lt;/script&gt;</code></pre>
  </div>
  </div>
  </p>
  <p>...and I could use a helping hand.</p>