examinedliving
7/29/2015 - 7:57 PM

Create a color theme picker from an ACF checkbox

Create a color theme picker from an ACF checkbox

//this needs cleaning
//b represents the parent ul that holds the checkboxes
//how this will be done may involve putting the color as the text for the label in question - that is what the code below demonstrates


jQuery(b).find('li').each(function(){var t=jQuery(this).find('label');m=t.contents();y=t.text().split(':')[1];var span=jQuery('<span />',{css:{'display':'inline-block','background-color':y,'width':'14px','height':'14px'}});x=m.filter(function(i){return (this.nodeType===3)})[0].textContent='';t.append(span)})


// css for the spans

/*    position: absolute;
    left: 0;
    top: 6px;
    width: 18px !important;
    height: 18px !Important;*/