Hi. I’m trying to change the entire div of another div with the querySelector and querySelectorAll. I previously have some code working on another page but just using the images. I’ve tried to apply the same principle but with just the first 4 to see if it works but apparently not.
Thank you for the clarification. I was intending to select the entire div but if that’s not possible I will have to select only the images. I would also like to display the images text. I’ve used document.getElementById() before but in this case as there is already a function in place I’m unsure what to do
Your img elements should always have an alt attribute with a value that describes what the image is. If you do that, then you could get rid of all the if/else if statements and simply assign the alt value of the targeted image to the innerHTML of the #samples_header div.