Support

Account

Home Forums Add-ons Repeater Field jQuery toggle with ACF repeater Reply To: jQuery toggle with ACF repeater

  • This is really outside of ACF. But what you’ll need to do is to pass the “toggle” that was clicked to the function, I’m not sure how to do this because I’m not all that familiar with jQuery. Then you need to get the container element and only target items in that element. from what I can find, something like this, but please note, I cannot promise this will work, I have not tested it and like I said, I’m not all that great with jQuery

    
    $(".toggle-trigger").click(function(){
      
      // I think that this will get the block on the toggle that was clicked
      var block = this.closest('.announcement-block');
    
      // I think this will toggle only this element
      block.find('.announcement-block-inner').toggle();
    
      // not sure how to change the icon given what you've supplied
      // I think what you need to do is get the icon element and change the class
      // based on the icon that is already shown
    });