kushal45 / jpicker

Automatically exported from code.google.com/p/jpicker
0 stars 0 forks source link

change() event #33

Closed GoogleCodeExporter closed 8 years ago

GoogleCodeExporter commented 8 years ago
What is the expected output? What do you see instead?

I need to be able to do something when user changes the color. Preferably even 
before he clicks on the "OK" button.  When I had a regular text input (no 
colorpicker), I'd simply do a $('input').change()... doesn't work with the 
jPicker.

What version of the product are you using? On what operating system?

1.1.6 (Google Chrome on Linux, but I guess it's not important).

Please provide any additional information below.

Users use the jPicker to pick a color, which is then used to re-draw a widget.  
I need to fire up the redraw_widget() function when user changes the color.

Original issue reported on code.google.com by mus...@gmail.com on 29 Dec 2011 at 12:55

GoogleCodeExporter commented 8 years ago
I figured it out, not sure if it's the best solution

I'm binding a click event to the OK button, like here:

$('input.Ok').live('click',function() {
update_code();
});

Original comment by mus...@gmail.com on 29 Dec 2011 at 1:02

GoogleCodeExporter commented 8 years ago
The plugin has always supported both commit callbacks (when they click ok) and 
live callbacks as they are altering the color. Additionally, by reading the 
documentation, you can also bind a function to the change event of the color 
object itself. The commit and live callbacks are just shorthand for attaching 
to the change events of the commit color or the live color object. The function 
when called will include the new color and the context from which the change 
originated.

Original comment by christop...@gmail.com on 27 Jan 2012 at 1:09