nodejs cheerio selecting child element inside an each loop

user8236024 picture user8236024 · Feb 23, 2018 · Viewed 11.2k times · Source

I'm trying to select the strong a tags that's inside the .info class

$(".info").each(function(i, item){
    console.log($(this).children("strong a").text())
});

it's selecting the info class correctly, just not the strong a

enter image description here

Answer

Jiby Jose picture Jiby Jose · Feb 23, 2018

You should be able to do

$(".info").each(function(i, item){
    console.log($("strong a", item).text())
});