Home › Forums › Front-end Issues › acf_form_head and color picker after ajax load › Reply To: acf_form_head and color picker after ajax load
Hi @tempranova
Firstly, make sure all the ACF scripts and styles are being loaded on the page, then when you AJAX request places the new html into the DOM, you will need to run a JS action on the new DOM elements.
Please note that in v5, this JS action will change, but for now it is a jQuery event called ‘acf/setup_fields’
You can read about how to use it here:
http://www.advancedcustomfields.com/resources/tutorials/adding-custom-javascript-jquery-for-fields/
To trigger the event on your new jQuery elements, use it like so:
var $el = $('.new-HTML-elements');
$(document).trigger('acf/setup_fields', [ $el ]);
Thanks
E
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.