Untitled

mail@pastecode.io avatar
unknown
plain_text
a month ago
1.2 kB
2
Indexable
Never
add_action('wp_head', function(){
	?>
	<script>
		function showHide(){
			jQuery('.b2bking_custom_registration_container_field_12900, .b2bking_custom_registration_container_field_12901, .b2bking_custom_registration_container_field_12902').hide();
			
			jQuery('#b2bking_field_12900, #b2bking_field_12901, #b2bking_field_12902').prop('required', false);
			
			let val = jQuery('#b2bking_field_12816').val();
			if (val === 'Gartenbau'){
				jQuery('.b2bking_custom_registration_container_field_12900').show();
				jQuery('#b2bking_field_12900').prop('required', true);
			}
			if (val === 'Viehzucht'){
				jQuery('.b2bking_custom_registration_container_field_12901').show();
				jQuery('#b2bking_field_12901').prop('required', true);
			}
			if (val === 'Sonstige'){
				jQuery('.b2bking_custom_registration_container_field_12902').show();
				jQuery('#b2bking_field_12902').prop('required', true);
			}
		}
		
		jQuery(document).ready(function(){
			setTimeout(function(){
				showHide();
			}, 100);
			jQuery('#b2bking_field_12816').on('change', showHide);
			jQuery('#b2bking_registration_roles_dropdown').on('change', function(){
				setTimeout(function(){
					showHide();
				}, 100);
			});
			
		});
	</script>
	<?php
});
Leave a Comment