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

Confusing css class name changes in javascript #13

Open
Tymski opened this issue Jul 24, 2020 · 0 comments
Open

Confusing css class name changes in javascript #13

Tymski opened this issue Jul 24, 2020 · 0 comments

Comments

@Tymski
Copy link

Tymski commented Jul 24, 2020

If I understood it correctly, the code overrides the className with every loop iteration.
b.className = "button"; is used to remove the "pressed" class.

To make it more clear, you could use the add and remove methods of classList property.
instead use buttonElement.classList.remove('pressed');
also utilize buttonElement.classList.add('pressed'); when it's needed.

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