Design comparison
Solution retrospective
the only defficlty i,ve that to make js style remove and active anothor style still hard for me tbh
Community feedback
- @AndyAshleyPosted over 2 years ago
hey f5rcbh, Good job on completing the challenge! As for your question, there are a few ways to do something like this. you can define a const with your element in it like:
const myElement = document.getElementById("my-id");
orconst myElement = document.querySelector("my-class");
then you can do something like
myElement.classList.add("another-class");
ormyElement.classList.remove("another-class");
if you have a css class with a toggle you can also play with that.
.my-class.active { color: white; }
then you can do
myElement.classList.toggle("active");
theres all sorts of ways you can select and toggle classes and styles, even data attributes.theres also stuff like
myElement.style.display = "none";
to change a style directly.hope that helps a bit, sorry for the long crazy comment haha. Happy Coding!
Marked as helpful1@f5rcbhPosted over 2 years ago@AndyAshley thank you mr andy for the feedback i will practice so much about it
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