cheerio / jquery selectors: how to get a list of elements in nested div's?

In cheerio and jquery, you get attributes with attr(), not attrib().

There are a few other problems with your code. Here is a working version using cheerio. It probably works in jquery this way as well.:

var list = [];
$('div[id="list"]').find('div > div > a').each(function (index, element) {
  list.push($(element).attr('href'));
});
console.dir(list);

For those who prefer a functional style:

const list = $('div[id="list"]')
  .find('div > div > a')
  .toArray()
  .map(element => $(element).attr('href')));