Design comparison
Solution retrospective
Hello guys,
I'm currently learning js. Kindly suggest me what went wrong?😅
How can i set my container div to be responsive?
Community feedback
- @Rtf747Posted almost 3 years ago
hi Badhri! I know what's wrong with your code. The clickable element that functions as a button is not a button, but a list item.
I think it would look better to change it to a <button> tag.
The logic of your Javascript is fine, only that when you select the "togglerbutton" element, it returns an array. That's why the toggler effect doesn't work. The same goes for your "card__sharebutton--active" element.
To correct this you can do it this way:
const button = document.getElementsByClassName('togglerbutton')[0];
const media = document.getElementsByClassName('card__sharebutton--active')[0];
By adding "[0]" you are indicating which position in the array you want to access.
Greetings!
Marked as helpful1
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