Guest User

Untitled

a guest
Jan 18th, 2019
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.98 KB | None | 0 0
  1. $('#sup_table-1 > tbody > ').append(
  2. '<td style="width: 60px;"><input style="width: 160px;" type="text" class="price number" id="price-'+vals+'"></td>'+
  3. '<td style="width: 60px;"><input style="width: 160px;" type="text" class="total" id="total-'+vals+'" readonly></td>'
  4. );
  5.  
  6. var controls = function(num){
  7. $("#price-"+num).keyup(function(){
  8. var mult = 0;
  9. $("tr.price-qty").each(function () {
  10. // get the values from this row:
  11. var $val1 = $('#qty-'+num, this).val();
  12. var $val2 = $('#price-'+num, this).val();
  13. var $total = ($val1 * 1) * ($val2 * 1)
  14. $('#total-'+num,this).val(numberWithCommas($total));
  15. mult += $total;
  16. });
  17.  
  18. $(".grandtotal").val(numberWithCommas($total));
  19.  
  20. });
  21. }
  22. controls(1);
  23.  
  24. function myFunction(){
  25. $("#sup_table-1 > tbody > tr").each(function(row, tr){
  26. var num = row+1;
  27. // var charges = $('#charges_name-'+asd).val();
  28. controls(num);
  29. console.log(num);
  30. });
  31. }
  32. myFunction();
Add Comment
Please, Sign In to add comment