Support

Account

Home Forums ACF PRO Expand Collapsed Repeater Row

Unread

Expand Collapsed Repeater Row

  • Hi,

    we display an ACF Form with repeater fields with another nested repeater inside each row in the frontend. On load we display all rows collapsed with the following code in the functions.php (I found last year in this forum I think):

    function my_acf_admin_footer() {
    	
        if (!is_admin()) {
        ?>
    <script type="text/javascript">
        (function($) {
            
            $(document).ready(function(){
                $('.acf-field-5cdba4aad5d60 .acf-row').addClass( "-collapsed" );
                $('.acf-field-5cdba4aad5d60 .acf-field-5cdba5b7d5d61').addClass( "-collapsed-target" );
                $('.acf-field-5cdba4aad5d60 .acf-field-5cdba5b7d5d61').attr( "colspan", "2" );
                
            });
        })(jQuery);    
        </script>
    	
        <?php
        }
    }
    add_action('acf/input/admin_footer', 'my_acf_admin_footer');

    Now I’d like the rows of a nested repater field inside the repeater to be expanded, when the main row is expanded. Iam not very familiar to JS, but maybe you have some advice for me.

    Thank you in advance
    Sebastian

Viewing 1 post (of 1 total)

You must be logged in to reply to this topic.