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

Possible to determine element from color:change etc. #245

Open
moracca opened this issue Nov 22, 2022 · 0 comments
Open

Possible to determine element from color:change etc. #245

moracca opened this issue Nov 22, 2022 · 0 comments

Comments

@moracca
Copy link

moracca commented Nov 22, 2022

When referencing a ColorPicker instance, we can call the el method on the object to get the HTML element that the color picker was mounted to. When we add callbacks to the color picker, for example color:change or input:end, we are passed a Color instance, that has properties describing the current color state of the picker.

My question however, is whether it is possible to determine within the callback function which ColorPicker this Color object corresponds to? The end goal being to grab some data-* attributes from the HTML element the color picker was mounted to in order to perform some action that is specific to this color picker (as opposed to other color pickers which may be rendered on the same page). Can this be done? I can't find a way to reference the element or ColorPicker instance from the Color instance, and don't see it listed in the Colors API, but it seems that this would be a common use case, so perhaps I am missing something.

Thanks!

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

1 participant