I am using cheerio to try and traverse the HTML of a website and I am trying grab the src attribute from the images but they are nested inside tags. I have tried a few solutions one example given below but no luck. Thank you in advance.
const snkrsproduct = $('a.card-link img');
const snkrsImg = snkrsproduct.attr('src');
console.log(snkrsImg);
It keeps returning undefined. My logic to this is that I am grabbing the a tag with a class of card-link and then the img and assigning that img src value to snkrsImg but obviously I am missing something.