Bookmark landing page, Accordion || CSS, HTML, JS

Solution retrospective
can somebody tell me how to change the fill of a svg from JS? i tried this but didn't worked out
const changeFill = () => { if(counter = 0){ counter++; logo.style.fill = "white" }else{ counter = 0; logo.style.fill = "#242A45" } }
Please log in to post a comment
Log in with GitHubCommunity feedback
- @ChamuMutezva
It is really important to to keep your styles away from your js and html, it is something that you can do by:
- create a class of the styles that you need to add with your js
- use js to add the class to your html when needed and remove it when it is not needed.
element.classList.add("classname") // element.classList.remove("classname")//
Marked as helpful
Join our Discord community
Join thousands of Frontend Mentor community members taking the challenges, sharing resources, helping each other, and chatting about all things front-end!
Join our Discord