I have a jQuery plugin I am trying to add a callback function for.
(I will not post all the code, but have provided a ready made JSFiddle instead: http://jsfiddle.net/39Uqr/)
View the JSFiddle – (after colour is selected, I want to fire a callback)
The plugin is quite simple, but I am having trouble adding a callback function for after a user has selected a colour. (So once a user has clicked on the box, the colorpicker shows, then once they select a colour, I would like to run a callback function [for ajax update], after the input field has been updated (it does it already)).
So basically, I need a callback function for when after a colour has been selected and updated the input.
I read the following posts on SO, and attempted this myself (for the last 2 hours!!), but just couldn’t get it to work.
a simple explanation would be very appreciated (optional, just need it working tho).
jQuery Plugin: Adding Callback functionality
and also tried
jQuery plugin callback
The plugin is called ‘Reallysimplecolorpicker‘
I made up a demo for you that 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.thisinside the callback refers to the element that you apply colorPicker to. Later that element will be removed from the DOM.I added an example that alert the rel attribute 😉