You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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.The text was updated successfully, but these errors were encountered: