Viewing 1 replies (of 1 total)
  • Thread Starter kierancalv

    (@kierancalv)

    In case this helps someone

    The fix is destroy reinitialize MiniColors after creating a new row.

    acf.add_action('append', function( $el ){ 
    
    $el.find('.rgba').each( function() {
    
     	        	$(this).minicolors('destroy')
     	        	initMiniColors($(this));
    
        			})
    
    		}
    
    		function initMiniColors($item) {
    
    			$item.minicolors({
        			  defaultValue: '0,0,0,0',
        			  inline: false,
        			  opacity: true,
        			  change: function(hex, opacity) {
        			    if(!hex) return;
        			    text = hex ? hex : 'transparent';
        			    if( opacity ) text += ', ' + opacity;
        				    text = jQuery(this).minicolors('rgbaString');
        				    $(this).closest('.toping').find('.rgbatext').val(text);
        				    $(this).closest('.toping').find('.opacity').val(opacity);
        				  },
        				})
    
    		};
    })

    [Moderator Note: Please post code between backticks or use the code button. Your posted code may now have been damaged by the forum’s parser.]

Viewing 1 replies (of 1 total)
  • The topic ‘query minicolors error’ is closed to new replies.