Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
Using a color picker with WPAlchemy
var picker_config = {
onSubmit: function(hsb, hex, rgb, el) {
onBeforeShow: function () {
onChange: function (hsb, hex, rgb) {
var el = $(this).data('colorpicker').el;
var keyup_handler = function(e) {
// initialize all current inputs
$('.color-picker').ColorPicker(picker_config).on('keyup', keyup_handler);
// event fired when an element is cloned
$.wpalchemy.on('wpa_copy', function(el){
// initialize the new colorpicker
$(el).ColorPicker(picker_config).on('keyup', keyup_handler);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment