title: Accessing elements by type in JavaScript
body: <p>A while ago I was making some test in JavaScript,
  and played with a code to get the text of all elements with a certain class.</p>
  <p>Now I was trying to make something like this but obtain all elements by a certain type, for example all elements <code>type=&quot;text&quot;</code></p>
  <p>Is there any way to do this in JavaScript or should I use jQuery?</p>
  <pre><code>var xx = document.getElementsByClassName(&quot;class&quot;);
  for (i=0;i&lt;xx.length;i++){
      var str=xx[i].innerHTML;
              alert(str);
  }
  </code></pre>