multiplication in dinamic row

multiplication in dinamic row

hello Jqueryer,

how can i make multiplication in dinamic row, i just succes make it in the first row, hope fully by image can make you understand what my problem,

and this is my code view

  1. <table class="table table-bordered">
  2. <tr>
  3.    <th><input class='check_all' type='checkbox' onclick="select_all()"/></th>
  4.    <th>#</th>
  5.    <th>Kode Barang</th>
  6.    <th>Nama Barang</th>
  7.    <th>Stock</th>
  8.    <th>Jumlah</th>
  9.    <th>Harga</th>
  10.    <th>Total</th>
  11. </tr>
  12. <tr>
  13.     <td><input type='checkbox' class='case'/></td>
  14.     <td><span id='snum'>1.</span></td>
  15.   <td><input class="form-control" type='text' id='kodebarang_1' name='kodebarang[]'/></td>
  16.     <td><input class="form-control" type='text' id='namabarang_1' name='namabarang[]' readonly /></td>
  17.     <td><input class="form-control" type='text' id='stock_1' name='stock[]' readonly /></td>
  18. <!---all i need is how do i make multiplication auto when user add row-->
  19.     <td><input class="form-control" type='text' id='jumlah_1' name='jumlah[]' onkeyup="hitung2();" /> </td>
  20. <td><input class="form-control" type='text' id='harga_1' name='harga[]' onkeyup="hitung2();" /> </td>
  21.     <td><input class="form-control" type='text' id='total_1' name='total[]'/> </td>
  22.   </tr>
  23.   </table>
  24.   <button type="button" class='btn btn-danger delete'>- Delete</button>
  25. <button type="button" class='btn btn-success addmore'>+ Add More</button>
  26. <button type="submit" class="btn btn-primary">Submit</button>

and this is my jquery multiplication
  1. function hitung2() {
  2. var a = $("#jumlah_1").val();
  3. var b = $("#harga_1").val();
  4. c = a * b; //a kali b
  5. $("#total_1").val(c);
  6. }

i think my problem is how to make it in array ? thanks for any respon, Thanks