2

On my checkout page I'd like to do some JavaScript on Inputs and other elements.

It seems like I can't access certain part of my page. To verify i tried $("form").html("these forms I could find");

description of problems

I use extension by IWD Agency, but I believe this has nothing to do with their module.

When editing JS inside module you can see that only Search bar and Payment Selection could be change, other forms remain unchanged.

When editing JS from my custom module I can change only Search Bar.

I guess this is caused by AJAX that forms are not loaded when the script runs. Any ideas how could this be changed?

Thank you!

9
  • 1
    You should read more here: inviqa.com/blog/technical-guide-magento-2-checkout Commented Dec 19, 2016 at 16:39
  • This didn't really help, since they are using KO javascript, I'd like to just add simple jquery to toggle inputs and do some interaction with shipping methods. But still, the JS works but is not applied to checkout form since it appears a bit later on the page. And again the weird part was that it affected payment options but nothing else. Commented Dec 19, 2016 at 17:05
  • 1
    Magento 2 used Knockout and Json Object template for rendering the One Page Checkout. For binding event, Knockout uses its own binding syntax- data-bind- to bind the event to the element. So, we need to add the custom event via data-bind. Commented Dec 19, 2016 at 17:06
  • Or, we can override the existing js component. The Js component used for rendering the template. Commented Dec 19, 2016 at 17:08
  • I'm a real beginner with KO. Is there any way to bind certain function to parent DIV? In link you posted they refer to XML file which I would like not to edit for this purpose. Commented Dec 19, 2016 at 17:39

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Browse other questions tagged or ask your own question.