title: cheerio / jquery selectors: how to get text in tag a?
body: <p>I am trying to access links on a website. The website looks like the first code sample and the links are in different div-containers:</p>
  
  <pre><code>&lt;div id="list"&gt;
    &lt;div class="class1"&gt;
      &lt;div class="item-class1"&gt;
        &lt;a href="http://www.example.com/1"&gt;example1&lt;/a&gt;
      &lt;/div&gt;
    &lt;/div&gt;
    &lt;div class="class2"&gt;
      &lt;div class="item-class2"&gt;
        &lt;a href="http://www.example.com/2"&gt;example2&lt;/a&gt;
      &lt;/div&gt;
    &lt;/div&gt;
  &lt;/div&gt;
  </code></pre>
  
  <p>I did tried to extract the links with this code:</p>
  
  <pre><code>var list = [];
  $('div[id="list"]').find('a').each(function (index, element) {
    list.push($(element).attr('href'));
  });
  </code></pre>
  
  <p>But the outputs look like this:</p>
  
  <pre><code>0: "http://www.example.com/1"
  1: "http://www.example.com/2"
  </code></pre>
  
  <p>But I want it to look like this:</p>
  
  <pre><code>0: example1
  1: example2
  </code></pre>
  
  <p>Thank you very much.</p>