After scraping a page , I have selected the footer of a table using cheerio with:
const $ = cheerio.load(data);
const foot = $('#tblAcctBal > tfoot > tr');
o = $(foot).html();
console.log(o);
results in the following html:
tr> <th rowspan=\"1\" colspan=\"1\"></th>
<th rowspan=\"1\" colspan=\"1\"></th>
<th rowspan=\"1\" colspan=\"1\"></th>
<th rowspan=\"1\" colspan=\"1\"></th>
<th rowspan=\"1\" colspan=\"1\"></th>
<th rowspan=\"1\" colspan=\"1\">$0.00</th>
<th rowspan=\"1\" colspan=\"1\">$0.00</th>
<th rowspan=\"1\" colspan=\"1\">$0.00</th>
<th rowspan=\"1\" colspan=\"1\">$0.00</th>
<th rowspan=\"1\" colspan=\"1\">$0.00</th>undefined</tr>\n
I'm trying to get an array of the text values in the footer. I've tried:
$(foot).each( function (th) {
console.log($(th).text().trim())
})
but I'm getting no output. How do I fix this?