Support

Account

Home Forums Backend Issues (wp-admin) ACF taxonomy dropdown using ajax Reply To: ACF taxonomy dropdown using ajax

  • Hi, i’m trying another way.. but obviously it doesn’t work..
    thank’s a lot to anyone can help me :
    A “second” dropwdown called “456” must have the value selected on the first called “123” ..
    PHP

    function my_acf_input_admin_footer() {
    	
    ?>
    <script type="text/javascript">
    (function($) {
    	
    	var x = document.getElementById("acf-field_123"); //first dropdown field
    
    	if (x.addEventListener) {                    // For all major browsers, except IE 8 and earlier
        	x.addEventListener("change", myFunction);
    	} else if (x.attachEvent) {                  // For IE 8 and earlier versions
        	x.attachEvent("onchange", myFunction);
    	}	
    	function myFunction(){
    		var x = document.getElementById("acf-field_123");
    		var y = document.getElementById("acf-field_456"); //second dropdown
    		x.value=y.value;
    	}
    	
    })(jQuery);	
    </script>
    <?php
    		
    }
    
    add_action('acf/input/admin_footer', 'my_acf_input_admin_footer');