Advertisement
Guest User

Untitled

a guest
Mar 2nd, 2015
182
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.50 KB | None | 0 0
  1. <td class="currency">
  2. <div>
  3. <input class="difference_textbox" type="text" value="0.00" style="display: none;" />
  4. </div>
  5. </td>
  6. <td>
  7. <div>
  8. <select style="display: none;" class="adj_reason_select">
  9. <option></option>
  10. </select>
  11. </div>
  12. </td>
  13.  
  14. // Let this function represent the function called on `difference` change.
  15. ReceivePayment._addAdjustment = function ReceivePayment$_addAdjustment(e) {
  16. var self = $(e.target);
  17. var customerInvoice = self.parents('.customer_invoice');
  18. var amountPaidBox = customerInvoice.find('.amount_to_pay_input');
  19. // ...
  20. var amountPaidTD = amountPaidBox.closest('td');
  21. var diffTextBoxTD = ReceivePayment._duplicateInputControl(amountPaidTD);
  22. var adjReasonSelectTD = ReceivePayment._duplicateInputControl(diffTextBoxTD);
  23. // ...
  24. }
  25.  
  26. ReceivePayment._duplicateInputControl = function ReceivePayment$_duplicateInputControl(td) {
  27. // This is very verbose so that I can stop at any point and
  28. // examine what I've got.
  29. var o = td.next(); // Grab the next td.
  30. var divs = o.children(); // Grab the div(s) contained within the td.
  31. var div = divs.last(); // Grab the last div within the td.
  32. // And here's where all my gyrations occur, infinite permutations
  33. // of jQuery calls, not one permutation of which has succeeded in
  34. // adding the contents of the final div to the list of divs.
  35. var d = div[0];
  36. var html = d.outerHTML;
  37. var s = html.toString();
  38. div.add(s);
  39. return o;
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement