Magento

How to add a custom checkbox with an event Magento 2?

Pinterest LinkedIn Tumblr

You can check below Js code

<script type="text/javascript">
    require(['jquery'], function($) {
        $(document).ready(function() {
            var ckbox = $('#checkout-order-approval-permission');
            $('#checkout-order-approval-permission').on('click', function() {
                if (ckbox.is(':checked')) {
                    $("#checkout-order-create-permission").prop('required', true);
                } else {
                    $('#checkout-order-create-permission').removeAttr('required');
                }
            });
        });
    });
</script>

Write A Comment

Faster PHP Cloud Hosting