Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get the name of the input in the change callback #23

Open
pitommasi opened this issue May 8, 2019 · 1 comment
Open

Get the name of the input in the change callback #23

pitommasi opened this issue May 8, 2019 · 1 comment

Comments

@pitommasi
Copy link

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...

@kypergio
Copy link

kypergio commented Mar 2, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants