Design comparison
Solution retrospective
I had two problems.. the JavaScript obviously - it only work if I add an id on a the 'answer' element, not when I selected them all, don't know why. And when it breaks to responsive view, the image is chopped of at the bottom
please help, i barely made even this much
Community feedback
- @AgataLiberskaPosted over 3 years ago
Hi @robot200, don't get discouraged, it will get easier with every project :)
Make sure to upload the images to your github repo, can't see the issue you're mentioning without them.
// answer.forEach(function (a) { // answer.addEventListener('click', function(e) { // toggleHidden(); // }) // })
Is this the function you were trying to make work? The issue I see there is that you're calling the
forEach
method on a nodelist, then in the callback you use(a)
, but then within the callback function, you're adding the eventlistener to the nodelist instead ofa
.You've also have more than one element with the class of 'dropdown' and you're only selecting one of them.
Hope this helps, if anything is not clear let me know and I'll do my best to help :)
1@robot200Posted over 3 years ago@AgataLiberska I honestly had no idea what I was doing at the end in js. Trying everything and now I'm not even sure what is the best way. I see some ppl use a loop to select and show/hide the answers.
0@AgataLiberskaPosted over 3 years ago@robot200 hahah don't worry, I've been there, and I'm pretty sure everyone else has, too! :D For me it often helps to add a few console.log() to see where I'm going wrong :)
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