Design comparison
SolutionDesign
Solution retrospective
What specific areas of your project would you like help with?
Changing the icon upon clicked, still wasn't able to change it using the svg file given
Community feedback
- @Alex-Archer-IPosted 4 months ago
Hi!
You can't change
src
of the icon cos you are usingquerySelector(".icon")
. It takes as parameter the same selectors as in css. So, you are trying to get element with a classicon
, but you only have element with idicon
.To reduce the number of constants and the make your code cleaner at all, you can use
querySelectorAll()
to get all the elements with the same selectors and write one function for all of them.Hope that helps. Feel free to ask if you have any questions =)
0
Please log in to post a comment
Log in with GitHubJoin 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