Register Here

Please upload your Medical Form

Scroll to Top
Troop 143 logo
Troop 143 logo
/** * Re-initialize dropdown functionality. * Add this code to your custom JS file. */ jQuery( function () { /** * Verifies that there is no empty value. */ function unselectEmptyOption( e ) { var $element = jQuery( e.currentTarget ); var $selected = $element.find( ':selected' ); if ( $selected.length > 1 ) { $selected.each( function ( i, option ) { if ( option.value === '' ) { option.selected = false; $element.trigger( 'change' ); } } ); } }; /** * Re-initialize dropdown functionality. */ function reInitializeDropdownFields() { if ( 'function' === typeof jQuery.fn.select2 ) { // Remove old dropdowns. jQuery( '.um-s1, .um-s2, .um-s3', '.um-form' ).filter('.select2-hidden-accessible').select2('destroy').off('select2:select').siblings('span.select2').remove(); // Initialize new dropdowns. jQuery( '.um-s1' ).each( function ( e ) { var obj = jQuery( this ); obj.select2( { allowClear: true, dropdownParent: obj.parent() } ).on( 'change', unselectEmptyOption ); } ); jQuery( '.um-s2' ).each( function ( e ) { var obj = jQuery( this ); if ( obj.parents( '.um-custom-shortcode-tab' ).length ) { var atts = { allowClear: false }; } else { var atts = { allowClear: false, minimumResultsForSearch: 10, dropdownParent: obj.parent() }; } obj.select2( atts ).on( 'change', unselectEmptyOption ); } ); jQuery( '.um-s3' ).each( function ( e ) { var obj = jQuery( this ); obj.select2( { allowClear: false, minimumResultsForSearch: -1, dropdownParent: obj.parent() } ).on( 'change', unselectEmptyOption ); } ); } } /** * Re-initializes dropdown functionality on the page load with timeout. * Advice: Try to enlarge a timeout if the issue is not solved. */ setTimeout( reInitializeDropdownFields, 99 ); /** * Re-initializes dropdown functionality on the Elementor popup open. * This part in needed for the Elementor popup only. */ jQuery( document ).on( 'elementor/popup/show', function () { jQuery( window ).trigger( 'resize' ); reInitializeDropdownFields(); } ); } );