title: jquery code stops working after ajax page load
body: <p>jquery code stops working after ajax page load.</p>
  <p>Initially, when the page loads, 20 products are loaded and this script works, but after switching to another page with products that is loaded with ajax, this code stops working</p>
  <pre><code>(function($){
      $(document).ready(function(){
          $(&quot;.variable-item.image-variable-item&quot;).on(&quot;click&quot;, function(){
              if($(this).parents('.jet-woo-product-button').length){
                  let btn = $(this).parents('.jet-woo-product-button').find('.add_to_cart_button');
                  if(btn.length){
                      btn.click();
                      btn.click(function(){
                          btn.data('clicked', true);
                      });
                      setTimeout(function(){
                          if(btn.data('clicked') != true){
                              btn.click();
                          }
                          btn.data('clicked', false);
                      }, 500);
                  }
              } else if($(this).parents('.variations_form').find('.single_add_to_cart_button').length){
                  let btn = $(this).parents('.variations_form').find('.single_add_to_cart_button');
                  if(btn.length){
                      setTimeout(function(){
                          btn.click(); 
                      }, 500);
                  }
              }
          });
      });
  })
  
  
  
  (jQuery);
  </code></pre>