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

More understandable code for multiple switches in documentation page #172

Open
kasim444 opened this issue May 1, 2019 · 0 comments
Open

Comments

@kasim444
Copy link

kasim444 commented May 1, 2019

Hello. First of all, I owe my gratitude to this library. I'm a little confused in the Javascript side for multiple checkboxes when reading documents. I've written a more understandable code block instead. I hope it can help. ( I would also like to discuss how better the code can be.🙋‍♂️ )

document.addEventListener("DOMContentLoaded", () => {
    startSwitcheryAtStart();
});

const startSwitcheryAtStart = () => {
    const checkboxElements = document.querySelectorAll(".js-switch");
    [...checkboxElements].map( el => {
        const switchery = new Switchery(el);
    });
};
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