title: How do I get a label's text with their classname in a loop?
body: <p>I have many labels with the same classname, but they all have different text. I want to loop through them and get this text. </p>
  
  <p>Here is what I have:</p>
  
  <pre><code>&lt;label class="mylabel pull-left"&gt; Hello &lt;/label&gt;
  &lt;label class="mylabel pull-left"&gt; olleH &lt;/label&gt;
  .....
  </code></pre>
  
  <p>I try this:</p>
  
  <pre><code>&lt;script&gt;
      var element = document.getElementsByClassName('mylabel');
      for(var i = 0; i&lt;element.length;i++) {
           alert(element[i].text());
      }
  &lt;/script&gt;
  </code></pre>
  
  <p>But I get this error:</p>
  
  <pre><code>TypeError: element[i].text is not a function
  </code></pre>
  
  <p>I tried <code>alert(element[i].text)</code> but that just returns <code>undefined</code>.</p>
  
  <p>But I can get its className with <code>alert(element[i].className)</code>, so why can't I get its text?</p>