Home › Forums › ACF PRO › Add new repeater row on front-end form with Javascript › Reply To: Add new repeater row on front-end form with Javascript
HI John,
That is great, but now how do I loop through the ACF input/textarea fields within that row? In the example:
acf.add_action('append', function( $el ){
// $el will be equivalent to the new element being appended $('tr.row')
// find a specific field
var $field = $el.find('#my-wrapper-id');
// do something to $field
});
I do not understand the $el.find(‘#my-wrapper-id’);. I do not know what the ID of this new row is.
I was trying to do $el.each(‘input’) or something like that and couldn’t get this to work.
After a second or whatever, then newly-created row seems to have an ID of sizzle1529351842030 and when you create another row, the previous sizzle-row loses its ID, and so on. Where does the “sizzle” get its numeric portion (1529351842030)? Is that related to the ACF internal ID or is it just a timestamp?
So what I would like is a way to access all of the ACF inputs/text areas, buttons, selects, on that new row, as I want to populate it dynamically. Also, I am unsure how to set the contents of an ACF wysiwyg (tinymce) field.
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.