Skip to content

Instantly share code, notes, and snippets.

@cubehrends
Last active May 22, 2017 12:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save cubehrends/a7728411a943dcd100b484812b112c9b to your computer and use it in GitHub Desktop.
Save cubehrends/a7728411a943dcd100b484812b112c9b to your computer and use it in GitHub Desktop.
(function($) {
var $select = $('#wc_checkout_add_ons_1');
$select.change(function () {
if ( $(this).val() == 'none' ) {
hideFields();
} else {
showFields();
}
});
function showFields() {
$('#wc_checkout_add_ons_2_field').show();
$('#wc_checkout_add_ons_3_field').show();
}
function hideFields() {
$('#wc_checkout_add_ons_2_field').hide();
$('#wc_checkout_add_ons_3_field').hide();
}
$select.val() == 'none' ? hideFields() : showFields();
} )( jQuery );
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment