When someone clicked the option, you need to add the flexible content just like when you clicked the Add Row button. You can emulate the click like this (you can try it on the JS console window):
jQuery('.acf-field-1234567890abc .button-primary').click(); jQuery('.acf-field-1234567890abc .acf-fc-popup [data-layout="flexible_layout_name"]').click();
Where “acf-field-1234567890abc” is the field class (based on field key) and “flexible_layout_name” is the layout name.
I hope this makes sense 🙂
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!
© 2023 Advanced Custom Fields.