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

Change elem to querySelector not just ID #40

Open
Malin88 opened this issue Jun 15, 2021 · 1 comment
Open

Change elem to querySelector not just ID #40

Malin88 opened this issue Jun 15, 2021 · 1 comment

Comments

@Malin88
Copy link

Malin88 commented Jun 15, 2021

Plz, change elem to querySelectorAll instead getElementById. Now I need to init plugin 8 times for each select and if I add another one in the future, than I need modify JS to add them too... so annoying :/

@hunterruth
Copy link

@Malin88 - this seems to work for me.

let selectDropdowns = document.querySelectorAll('select');

    selectDropdowns.forEach((dropdown) => {
        new CustomSelect({
            elem: dropdown
        });
    });

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