DEV Community

Discussion on: Making a Toggle Switch into a New HTML Element

Collapse
 
dannyengelman profile image
Danny Engelman

Good moment to learn classList.toggle and toggleAttribute

Collapse
 
auroratide profile image
Timothy Foster

Huh, didn't actually know about toggleAttribute, good to know! That said, kinda unsure where to really use them here 🤔

Collapse
 
dannyengelman profile image
Danny Engelman

Everywhere you now use setAttribute to undo a state

Thread Thread
 
auroratide profile image
Timothy Foster

Ok I finally see what I missed: there's an optional attribute to force it into one state or the other. I'll update everything!

Thanks for the feedback!