HEX
Server: Apache/2.4.52 (Ubuntu)
System: Linux spn-python 5.15.0-89-generic #99-Ubuntu SMP Mon Oct 30 20:42:41 UTC 2023 x86_64
User: arjun (1000)
PHP: 8.1.2-1ubuntu2.20
Disabled: NONE
Upload Files
File: /var/www/html/bwcdev/wp-content/plugins/gravityforms/includes/settings/js/select-custom.js
window.addEventListener( 'load' , function() {

	var $selectOptions = document.querySelectorAll( '.gform-settings-field__select_custom select' );
	var $buttons       = document.querySelectorAll( '.gform-settings-select-custom__reset' );

	$selectOptions.forEach( function( $select ) {

		var $inputField = $select.parentNode.nextSibling;

		$select.addEventListener( 'change', function( e ) {

			if ( e.target.value !== 'gf_custom' ) {
				return;
			}

			// Hide drop down, show input.
			$select.style.display     = 'none';
			$inputField.style.display = 'block';

		} );

	} );

	$buttons.forEach( function( $button ) {

		var $inputField = $button.parentNode;

		$button.addEventListener( 'click', function( e ) {

			// Hide input, show drop down.
			$inputField.style.display = 'none';
			jQuery( this )
				.closest('div.gform-settings-field__select_custom')
				.find( 'select' )
				.each( function( index, element ) {
					element.value         = '';
					element.style.display = 'block';
				}
			);

		} );

	} );

} );