@Alex-Archer-I
Posted
Hi!
You can't change src
of the icon cos you are using querySelector(".icon")
. It takes as parameter the same selectors as in css. So, you are trying to get element with a class icon
, but you only have element with id icon
.
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 =)