title: How to select a row in html table take 2 columns multiply and show results in third column
body: <p>I have HTML table (with data table) , with column like product price and product quantity and total, I want to update total column when price and quantity are filled.</p>
  
  <pre><code> &lt;table id="example1" class="table table-bordered table-striped dataTable " role="grid" aria-describedby="example1_info"&gt;
          &lt;thead&gt;
              &lt;tr&gt;
                  &lt;th&gt;ID&lt;/th&gt;
                  &lt;th&gt;Name&lt;/th&gt;
                  &lt;th&gt;Price&lt;/th&gt;                           
                  &lt;th&gt;Quantity&lt;/th&gt;
                  &lt;th&gt;Total&lt;/th&gt;
              &lt;/tr&gt;
          &lt;/thead&gt;
          &lt;tbody&gt; 
              &lt;?php 
                  while($user = $products-&gt;fetch_assoc()){
                    ?&gt;
                    &lt;tr&gt;
                      &lt;td&gt;&lt;?=$user['id']?&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;?=$user['name']?&gt;&lt;/td&gt;
                      &lt;td&gt;
                        &lt;input type="number" class="pr price" name="row_id_&lt;?=$user["id"] ?&gt;" pr_id='&lt;?=$user['id']?&gt;'  value="" 
                        onchange= "add_to_p_total(this)" style="width: 60px; height: 26px"&gt; 
                      &lt;/td&gt;    
                      &lt;td&gt;
                        &lt;input type="number" class="pr qty" name="row_id_&lt;?=$user["id"] ?&gt; pr_id='&lt;?=$user['id']?&gt;' value="" 
                        onchange= "add_to_q_total(this)" style="width: 60px; height: 26px"&gt;
                      &lt;/td&gt;
                       &lt;td&gt;
                         &lt;input type="number" name="row_id_&lt;?=$user["id"] ?&gt;  class="pr total_price" style="width: 60px; height: 26px"&gt;
                       &lt;/td&gt;
                    &lt;/tr&gt;
                    &lt;?
                  }
              ?&gt;
              &lt;tr&gt;
                      &lt;td&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;/td&gt;
                      &lt;td&gt;&lt;strong id="p_total"&gt;&lt;/strong&gt;&lt;/td&gt;
                      &lt;td&gt;
                        &lt;strong id="q_total"&gt;&lt;/strong&gt;
                      &lt;/td&gt;
                    &lt;/tr&gt;
          &lt;/tbody&gt;
          &lt;tfoot&gt;
             &lt;tr&gt;
                  &lt;th&gt;ID&lt;/th&gt;
                  &lt;th&gt;Name&lt;/th&gt;
                  &lt;th&gt;Price&lt;/th&gt;                             
                  &lt;th&gt;Quantity&lt;/th&gt; 
                  &lt;th&gt;Total&lt;/th&gt;             
              &lt;/tr&gt;
          &lt;/tfoot&gt;
      &lt;/table&gt;
  </code></pre>
  
  <p>The problem is table dynamically generated using PHP and database, so in this case some sort of dynamic js is required I'm guessing that I have to somehow access columns with indexes and multiple [2] and [3] index. I don't know how to do that using jquery or js. </p>
  
  <p>Later on I also need to send this table data to backend using AJAX, please suggest what are the best practices to do such kind of things.</p>