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.

Viral Patel
1,1001 gold badge8 silver badges17 bronze badges
asked Oct 27, 2021 at 7:18
2
  • you have to try with if(jQuery.trim(v) == 'simpleshipping_simpleshipping'). and check that Commented 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 Commented 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 */
}
answered Oct 27, 2021 at 8:29

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.