Add callback function to plugin (colorPicker)

I have a jQuery plugin. I am trying to add a callback function for.
(I won't post all the code, but a ready-made JSFiddle instead : http://jsfiddle.net/39Uqr/ )

JSFiddle View - (after color picking I want to trigger callback)

The plugin is pretty simple, but I find it difficult to add a callback function after the user has selected a color. (So ​​once the user has clicked on the field it will display a colorpicker and then when they select a color I would like to trigger a callback function [to update the ajax] after the input field has been updated (it already does this)).

Basically I need a callback function when after color selection and input update.

I read the following posts on SO and tried this myself (last 2 hours!) But just couldn't get it to work.

View JSFiddle

a simple explanation would be much appreciated (optional, just needs it to work).

JQuery plugin: adding a callback function
and also tried the jQuery plugin callback

The plugin is called ' Reallysimplecolorpicker '

+3


source to share


1 answer


I put together a demo for you, which I think is what you are looking for:

http://jsfiddle.net/ab7cU/4/

I added a comment // New line!

for every new line that I added to the code.



this

inside the callback refers to the element to which the colorPicker is applied. This element will later be removed from the DOM.

I added an example warning rel attribute; -)

+2


source







All Articles