Support

Account

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