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

How can I access original option elements from the callbackOnCreateTemplates? #1149

Closed
stratboy opened this issue Mar 10, 2024 · 1 comment · Fixed by #1166
Closed

How can I access original option elements from the callbackOnCreateTemplates? #1149

stratboy opened this issue Mar 10, 2024 · 1 comment · Fixed by #1166

Comments

@stratboy
Copy link

Hi, I'm trying to retain some data-props that are setted in the original select dom element, to persist them in choices and items. I'm having quite an hard time in doing this.

Is it possible? I just need a reference to the origina option element related to the current template item/choice.

@Xon
Copy link
Collaborator

Xon commented Jul 30, 2024

I also missed it, but the readme.md has an example of touching the default templates to adjust the output similar to:

const example = new Choices(element, {
  callbackOnCreateTemplates: () => ({
    input: (...args) =>
      Object.assign(Choices.defaults.templates.input.call(this, ...args), {
        type: 'email',
      }),
  }),
});

@Xon Xon linked a pull request Aug 6, 2024 that will close this issue
9 tasks
@Xon Xon closed this as completed Aug 6, 2024
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

Successfully merging a pull request may close this issue.

2 participants