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');
Welcome to the Advanced Custom Fields community forum.
Browse through ideas, snippets of code, questions and answers between fellow ACF users
Helping others is a great way to earn karma, gain badges and help ACF development!
We use cookies to offer you a better browsing experience, analyze site traffic and personalize content. Read about how we use cookies and how you can control them in our Privacy Policy. If you continue to use this site, you consent to our use of cookies.