I can’t figure out how the clear the posters after a new search request I tried my best on my own but help would be appreciated. I’ve attached screenshots it’s a tv show search and it gets posters from an API for posters matching the query
Couple things. First, querySelectorAll doesn’t return an HTML element, it returns an array (a NodeList, but works as an array) - and an array doesn’t have a removedAttribute.
Second, getting rid of an image’s src doesn’t removes the image. Consider a looping mechanism of your choice over all the images and, for each image, use DevDocs
What do you get if you console.log allImg
? I’m wondering if we ever reach that line…
The console.log doesn’t run so i think you are right.
Try defining allImg
before the if statement, creating the array, and then check if( allImg.length > 0){ ... }
Thank you so much snowmonkey that actually worked god bless you, this problem was eating away at me for 3 days
Glad we figured it out, might be worth working into the curriculum somewhere…
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.