meteor - extracting html element with cherrio -


this meteor server code uses cheerio , tries extract text 'john', tried few different ways below no avail.
console.log(e.next.children.eq(1).text()); console.log(e.next.children.last().text()); console.log(e.next.contents().last().text());

how can done cheerio? thanks

resobj.$("table").contents().filter(function() {   return this.nodetype == 8; }).each(function(i, e) {   if (e.nodevalue.trim() == 'contacts') {     console.log(e.next.contents('td').eq(1).text()); //<----------     console.log(e.nextsibling.nodetype);  // returns 3   } });   <!-- contacts --> <tr>   <td class="label" valign="top" align="right" style="white-space:nowrap">     names of people:&nbsp;&nbsp;   </td>   <td class="displayvalue" valign="top">      john    </td> </tr> 

cheerio jquery (for part), why building complex structure when need is:

$('table .displayvalue').each(function () {   console.log($(this).text()); }); 

let's break down code have:

// tables contents, filter data resobj.$("table").contents().filter(function() {   // return comments? https://developer.mozilla.org/en-us/docs/web/api/node/nodetype ... should using ===   return this.nodetype == 8; // loop through of filtered elements }).each(function(i, e) {   // check string of comment text want --- bad style   if (e.nodevalue.trim() == 'contacts') {     console.log(e.next.contents('td').eq(1).text()); //<----------     console.log(e.nextsibling.nodetype);  // returns 3   } }); 

so reasons why going through these loops, selector has class accessible?