0
jQuery('input[name^="ko_unique_"]').trigger("change");
        
        jQuery('input[name^="ko_unique_"]').change(function() {
        var v = jQuery(this).val();
        console.log(v);
        if(v == 'simpleshipping_simpleshipping'){
            console.log('check');
            jQuery('#deliv-hold').show();
        }
        else{
            jQuery('#deliv-hold').hide();
        }
        });

The above-mentioned code is working fine on the console but when it is used in js. it does not execute after the second line.

2
  • you have to try with if(jQuery.trim(v) == 'simpleshipping_simpleshipping'). and check that Oct 27, 2021 at 7:26
  • It is not printing the value of v in the console i.e., only the first two lines are working. after thats it exits
    – Praveen C
    Oct 27, 2021 at 8:28

1 Answer 1

0

You should use .on() instead of traditional .change() event,

$(document).on('change', 'input[name^="ko_unique_"]', function(e) {
/* your code here */
}

Your Answer

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

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