jquery-palette-color-picker icon indicating copy to clipboard operation
jquery-palette-color-picker copied to clipboard

Get the name of the input in the change callback

Open pitommasi opened this issue 5 years ago • 1 comments

Since I have more than a single colour picker in a page, I need in the onchange_callback the name of the corresponding input.

Now I get it with parent().parent() and all that jazz but I don't like too much... It would have been better to get it referenced directly...

pitommasi avatar May 08 '19 10:05 pitommasi

Hi @pitommasi ... I know this could be a old question but I would answer anyway if you still need it...

I have managed with an event change. I fired it in the pallete's callback like this:

onchange_callback: function (clicked_color) { variables.color.trigger("change", [{"color": clicked_color}]); } image

Where "color" is a variable name you decide.

And I get that value like this:

variables.color.on("change", function(e,data){ e.preventDefault(); var color = getColorName(data.color); graficarPorColor(color); }); image

Where data is what you sent trough fire in the callback. I hope it's what you need. Regards

kypergio avatar Mar 02 '20 23:03 kypergio