title: JavaScript get elements by class name and tag name
body: <p>I wanted to get a list of DOM elements by class name and tag name in JavaScript, not using jQuery.</p>
  
  <p>For example I need to get all <code>&lt;ul&gt;</code> elements with class <code>.active</code></p>
  
  <pre><code>var elements = document.getElementsByTagName("ul");
  var activeElements = document.getElementsByClassName('active')
  </code></pre>
  
  <p>What is the fastest and best way to do this in JavaScript. </p>
  
  <p>No external libraries like jQuery or <a href="https://github.com/cheeriojs/cheerio" rel="noreferrer">cheerio</a></p>