1
 <script type="text/javascript">
    require([ 'jquery', 'jquery/ui'], function($){ 
    $( "#checkoutnext" ).click(function() { 
        alert("Test!");
    });
 });
 </script>

I am using this code on onepagecheckout. but not working any Idea or suggestion

0
11

Use below code

<script type="text/javascript">
    require([ 'jquery', 'jquery/ui'], function($){
        $(document).on("click","#checkoutnext", function() {
            alert("Test!");
        });
    });
</script>
1
  • Grate Bro. Love it. Thanks A lot for save my time. – SURENDER SINGH May 28 '18 at 7:19
1

You need to rewrite form.html knockout template of Magento_Checkout in your theme.

app\design\frontend\Vendorname\Themename\Magento_Checkout\web\template\billing-address\form.html

replace below div

<div class="billing-address-form" data-bind="fadeVisible: isAddressFormVisible">

to

<div class="billing-address-form" data-bind="fadeVisible: isAddressFormVisible, afterRender: renderedHandler">

Rewrite billing-address.js in your theme

app\design\frontend\Vendorname\Themename\Magento_Checkout\web\js\view\billing-address.js

add below function in above js file

        /**
         * after form render handler
         *
         */
        renderedHandler: function (elements, data) {
          //add your custom js code here
        }

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.