MCPcopy Create free account
hub / github.com/SuperSimpleDev/javascript-course / toggleButton

Function toggleButton

1-exercise-solutions/lesson-10/10f.js:2–9  ·  view source on GitHub ↗
(selector)

Source from the content-addressed store, hash-verified

1// The word "toggle" means turn on/off.
2function toggleButton(selector) {
3 const button = document.querySelector(selector);
4 if (!button.classList.contains('is-toggled')) {
5 button.classList.add('is-toggled');
6 } else {
7 button.classList.remove('is-toggled');
8 }
9}

Callers

nothing calls this directly

Calls 1

addMethod · 0.45

Tested by

no test coverage detected