Advertisement
Guest User

Untitled

a guest
Jul 26th, 2017
46
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. $(document).ready(function(){
  2. Determine();
  3. });
  4.  
  5. //Determine which products are still in stock and hide them
  6.  
  7. function Determine() {
  8. var id1,
  9. id2,
  10. sum = 0;
  11. $("td.ProductID1").each(function(){
  12. id1 = parseInt($(this).text());
  13. sum = 0;
  14. $("td.ProductID2").each(function(){
  15. id2 = parseInt($(this).text());
  16. if(id1 == id2){
  17. sum += parseInt($(this).closest('tr').children('td:nth-child(2)').text());
  18. }
  19. }
  20. );
  21. if(sum >= parseInt($(this).closest('tr').children('td:nth-child(5)').text())){
  22. $(this).closest('tr').hide();
  23. }
  24.  
  25. });
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement