Support

Account

Home Forums Add-ons Repeater Field Load Select Post Subfields on Repeater Reply To: Load Select Post Subfields on Repeater

  • I would probably do something like this for the on change event

    
    $('[data-key="field_5e7c9a8b2e9ca"] .acf-row [data-key="field_5e7c9ad82e9cc"] .acf-input input').on(...
    

    Not that above the final “input” is the type of input field used. the first data-keu is the key of the repeater. The second data key is the key of the sub field.

    However, this will not work. The reason for this is that the repeater row may not exist and in this case you must do it differently so that you can target elements that are dynamically created by JS, like this

    
    $(document).on(
      'change',
      '[data-key="field_5e7c9a8b2e9ca"] .acf-row [data-key="field_5e7c9ad82e9cc"] .acf-input input',
      function(e) {
        // your function code here
      }
    );
    

    and then get the row that you are working on

    
    var row = $(this).closest('.acf-row');
    

    Then you target the sub field you want to change by doing the following same not as above about the type of field.

    
    var other_field = row.find('[data-key="field_5e7c9ad82e9d0"] .acf-input input')