Home › Forums › Add-ons › Repeater Field › JS "append" action and some value in new field › Reply To: JS "append" action and some value in new field
For some reason I thought that I should give the value to $field object, just didn`t know to what key.
At this moment I ended with this
acf.add_action('append', function( $el ){
/* $el will be equivalent to the new element being appended $('tr.row') */
var setvalue = jQuery('#post_ID').val() + 'h' + (new Date().getTime()).toString(36);
var $row = $el.closest('.acf-row');
$row.find('.acf-field-5995fe2ea9aad input').val(setvalue);
});
to add new value to the field. It shows the value in field.
Important – I add disabled
attribute to the field via JS and it was not saved to database, be careful.
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.