Title: Bug in checkout.js
Last modified: August 22, 2016

---

# Bug in checkout.js

 *  Resolved [4alexandr](https://wordpress.org/support/users/4alexandr/)
 * (@4alexandr)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/bug-in-checkoutjs/)
 * Bug present in [http://plugins.svn.wordpress.org/jigoshop/tags/1.15.5/assets/js/checkout.js](http://plugins.svn.wordpress.org/jigoshop/tags/1.15.5/assets/js/checkout.js)
 * You create AJAX request “jigoshop_update_order_review” and replace exists page
   content with response:
    Line 62 `$('#order_review_heading').after(response);`
 * Then you call click event on selected payment element
    `$payment_method.click();`
   Problem: $payment_method contains old DOM element, which was replaced with AJAX
   response. You must call click for new DOM element: `jQuery('input[name=payment_method]:
   checked').click();`
 * Next
    Line 161 `$('.payment_methods').on('click', '.input-radio', function(){`
   You bind event direct to .payment_methods DOM elements, which was replaced with
   response too. You must bind event to document element `jQuery(document).on('click','.
   payment_methods .input-radio', function(){`

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [megawebmaster](https://wordpress.org/support/users/megawebmaster/)
 * (@megawebmaster)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/bug-in-checkoutjs/#post-5812861)
 * Hello [@4alexandr](https://wordpress.org/support/users/4alexandr/),
 * Unfortunately you are mistaken: the code you mention removes only `div#order_review`
   and adds another `div#order_review` from the `jigoshop_update_order_review` AJAX
   action. Nothing else is replaced thus `$payment_method` and everything else is
   still in the DOM as it was before calling this method.
 * Please take a closer look at the code and code for `jigoshop_update_order_review`
   AJAX action.
 *  Thread Starter [4alexandr](https://wordpress.org/support/users/4alexandr/)
 * (@4alexandr)
 * [11 years, 2 months ago](https://wordpress.org/support/topic/bug-in-checkoutjs/#post-5812877)
 * I looked at the code in more detail, you’re right.
 * But code
    `$('#order_methods, #order_review').remove();` removes two elements.
   I saw #order_methods and it directed me in the wrong direction.
 * My problem – someone change template and #payment now in #order_review element.
 * I will fix it, thanks.

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Bug in checkout.js’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/jigoshop_655549.svg)
 * [Jigoshop](https://wordpress.org/plugins/jigoshop/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/jigoshop/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/jigoshop/)
 * [Active Topics](https://wordpress.org/support/plugin/jigoshop/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/jigoshop/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/jigoshop/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [4alexandr](https://wordpress.org/support/users/4alexandr/)
 * Last activity: [11 years, 2 months ago](https://wordpress.org/support/topic/bug-in-checkoutjs/#post-5812877)
 * Status: resolved