Automattic / Iris

A(n awesome) Color Picker

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

While selecting a color input value isn't changed.

MrVibe opened this issue · comments

commented

Screen Shot 2013-03-21 at 6 05 47 PM
I am using Iris using the most simple call:
$(".popup-colorpicker").iris();
When any color is selected the value of the input type text isn't changed, so when my other scripts grab the value of the input field they show the default value.
Can we include a stop function, so when color selecting is done I can change the value of the input field?

Thanks for at least showing an image illustrating your issue! A jsfiddle would have been even better. :)

So, in this case, it merely looks like the dev tools aren't updating the value field of the input element in real time. The value is being updated, as you can see on the page.

Otherwise, you can always get the live value of an Iris instance by calling $(el).iris('color') (or, if you're using the version bundled with WP 3.5.x, $(el).iris('option', 'color') - WP 3.6 will have the shorter method.). You can also attach a change callback:

$(el).iris({
  change: function( event, ui ) {
    // ui.color.toString() gives you the current color in hex notation.
    // do what you need to with it.
  }
});

This is all in the documentation.

commented

Awesome..that worked.