Alright, I am working on a school assignment where I have 4 containers. When you click a button in a container, a popup shows the image and heading of the container you clicked on. I have figured out how to get the image to display, but I'm struggling with getting the heading, which is the second child element in the container. Unfortunately, I can only use HTML, CSS and JavaScript for this assignment. I'm new to this, so please be patient and kind. Here is my code, any help would be greatly appreciated.
document.getElementById('bigImage').src =
this.parentNode.firstElementChild.src;
document.getElementById('title').textContent =
this.parentNode.secondElementChild.textContent;