I'm making an A/B test (Injecting code onto a page) to increase the images of products in your shopping cart.
When you select a different shipping method - the whole table appears to be refreshed.
and my code will only execute the first time.
So when i select a different shipping method the second time. my code is lost.
Except the tags stay.
You'll need to have a random product in your cart to see it first.
<script>
$( document ).ready(function() {
 $('img.item-img').each(function() {
    var str      = $(this).attr('src'),
        arr      = str.split("?");
  query  = "?hei=200&wid=200&op_sharpen=1"
    $(this).attr('src', arr[0] + query);
});
  
  $( document ).ready(function() {
    $('tr').each(function() {
  var desc = $('td.description', this).html() 
  $('td.image', this).append(desc);
  $('td.description', this).remove();
});
  $("table#shopping-cart-items tr td.image").after($('<td id="clearSpace"></td>'));
});
});
  
  </script>
<script>
  
  
  $( document ).ready(function() {
    $('div.shippingOpt').click(function() {
  
  
   window.setTimeout(function(){  
 
 
  $('img.item-img').each(function() {
    var str      = $(this).attr('src'),
        arr      = str.split("?");
  query  = "?hei=200&wid=200&op_sharpen=1"
    $(this).attr('src', arr[0] + query);
});
 
   $('tr').each(function() {
  var desc = $('td.description', this).html() 
  $('td.image', this).append(desc);
  $('td.description', this).remove();
});
                     
  $("table#shopping-cart-items tr td.image").after($('<td id="clearSpace"></td>'));
     
          }, 1000);           
                    });
});
  </script><style>
    .checkoutBasket table.cart-container td.image img { width:200px; height:auto;}
  
 #clearSpace  {padding: 0 0 0 15px;}
</style> 
     
    