Automattic / Iris

A(n awesome) Color Picker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

SetDefault option

gchokeen opened this issue · comments

I have number of form fields. I reset all the form fields value but color picker is not showing the default color.

Does this plugin support this feature or not ?

    var background_color = jQuery('#background_color');
        background_color.val(background_color.attr('data-real')).wpColorPicker({color:background_color.attr('data-real')});

I thought color option will do that, but it doesn't

This is not the wpColorPicker project, this is the Iris project. wpColorPicker uses Iris, and I worked on both, so the confusion is understandable. Iris is well documented.

wpColorPicker, on the other hand, is not. But in either case, if you're taking action to directly set the value of the input element, you just need to manually trigger the change event, since the picker doesn't know something has changed otherwise.

$('#bg-color').val( newValue ).change();

It's awesome it works, thanks