3

I am modifying the WooCommerce checkout template files (php) so that I have additional buttons right before the "Place Order" button.

You can see the basic WooCommerce functionality on this WooCommerce demo page https://demo.woothemes.com/storefront/checkout/ if you add an item to the cart first.

I need to bind jQuery functions to the newly added buttons. Unfortunately the functions are not executed. Only if I add the buttons at a "higher level" of the template the jQuery works properly.

Are there some AJAX requests that are somehow unbinding my jQuery? How can I solve this?

Thank you in advance.

Benjamin

Ben Spi
  • 756
  • 1
  • 9
  • 23

1 Answers1

3

I found a solution to my question, which is here: Jquery events not working on ajax loaded content

The solution is to use an on click with jQuery

$('body').on('click','.heading',function(){
     $(this).css('color','red');  
});
Community
  • 1
  • 1
Ben Spi
  • 756
  • 1
  • 9
  • 23