Search code examples
jquerycolor-picker

jQuery plugin: Colorpicker onHide Event


I'm using www.eyecon.ro/colorpicker/ and binding the color picker to a class so there are potentially hundreds of color pickers.

I edited the plugins change event to return the element From:

cal.data('colorpicker').onChange.apply(cal, [col, HSBToHex(col), HSBToRGB(col));

To:

cal.data('colorpicker').onChange.apply(cal, [col, HSBToHex(col), HSBToRGB(col), cal.data('colorpicker').el]);

This works out great, each time it changes color i update the element.

Now i need to do something similar for the hide function. When its hidding id like to commit the changes to the database. I think i need to change the following line, but i cant seem to get the correct reference to the element.

From

if (ev.data.cal.data('colorpicker').onHide.apply(this, [ev.data.cal.get(0)]) != false)

To

if (ev.data.cal.data('colorpicker').onHide.apply(this, [ev.data.cal.get(0),MY_ELEMENT]) != false)

Can anyone help me out?


Solution

  • I was right, where i have MY_ELEMENT change it to ev.data.cal.data('colorpicker').el