@Serdarq1
Posted
Hi, I checked your script and the error happens because of usage of the querySelector. querySelector selects only the first child of multiple tags. There are multiple things you can do to improve your solution. Firstly, you can use querySelectorAll and then use forEach to loop every single item however if you are new to javascript I would not recommend it. Secondly, instead of using onClick on html page you can create event listener(questionContainer.addEventListener("click", () => {})) and you can loop every single item with forEach or you can name every container's class something different and add event listener to all. If you get stuck at somewhere you can ask again. Hope you find this helpful
Marked as helpful
@tAndreii
Posted
Hi, thank you for explanation, it's very helpful!!!