Home › Forums › Add-ons › Repeater Field › Load Select Post Subfields on Repeater › Reply To: Load Select Post Subfields on Repeater
This example is for a select field that changes the selections in s second select field, but does not deal with the repeater https://github.com/Hube2/acf-dynamic-ajax-select-example/tree/master/dynamic-select-example.
In order to work with repeaters it is important to do the other setps
valueSelect = $(this).val();
var current_row = $(this).closest('.acf-row');
var field_to_change = current_row.find('[data-key="key of other field"] .acf-input FIELD TYPE');
I’m not really sure about the $(this) part. As you can see in the example I gave you, I generally work with the value passed to the function in “e” the event. $(e.target)
gives me element that triggered the event.
$(document).on('change', '{SELECTOR}, function(e) {
var target = $(e.target);
var row = target.closest('.acf-row');
var field_to_change = row.find(['data-key="{FILED KEY}"] .acf-input {FIELD TYPE}');
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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.