Support

Account

Home Forums Add-ons Repeater Field Repeater Script Support on Custom Field

Solving

Repeater Script Support on Custom Field

    • vbkun

    • April 20, 2019 at 4:00 am

    Hi

    I’m trying to find out (with no luck) how do I get a function to run when a new line is created by the ‘add’ button on the repeater.

    I created a field which runs a script to mask it, but then inside the repeater this script is not run.

    Any correct way to proceed?

  • in a javascript file you can add this code to run when a row is added to the repeater field

    (function( $ ) {

    $(".acf-input .acf-repeater").on('click a[data-event="add-row"]', function(evt, el){
        console.log(evt);
    });
    
    })( jQuery );
  • See the actions section of the JS API doc https://www.advancedcustomfields.com/resources/javascript-api/#actions. The append action is fired when a new row is added.

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.

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 Cookie Policy. If you continue to use this site, you consent to our use of cookies.