Advertisement
Guest User

Untitled

a guest
Jun 18th, 2019
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.74 KB | None | 0 0
  1. document.trigger = false;
  2.  
  3. var shippingMethod = function(element){
  4.  
  5. if(!document.trigger){
  6.  
  7. document.trigger = true;
  8.  
  9. var currentIndex = element.closest('div.radio').index();
  10.  
  11. $(document).find('div.shopping-store-shipping input').attr('checked', false);
  12.  
  13. $(document).find('div.shopping-store-shipping').each(function(){
  14.  
  15. $(this).find('div.shipping-estimate div.radio').each(function(){
  16.  
  17. if($(this).index() === currentIndex){
  18.  
  19. $(this).find('label')[0].click();
  20.  
  21. }
  22.  
  23. });
  24.  
  25. });
  26.  
  27. document.trigger = false;
  28.  
  29. }
  30.  
  31. };
  32.  
  33. $(document).find('.shipping-method').on('change', function(){
  34.  
  35. new shippingMethod($(this));
  36.  
  37. });
  38.  
  39. $(document).find('div.shipping-estimate div.radio label').on('click', function(){
  40.  
  41. new shippingMethod($(this));
  42.  
  43. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement