title: getElementById to getElementsByClassName
body: <p>I have this code which is working. But it is only for one textarea because it uses ID. However i would like to use this for all textareas that on my code. I have tried getElementsByClassName but it didn't work.</p>
  
  <p>HTML:</p>
  
  <p><code>&lt;textarea id="textarea1" class="form-control page-textarea" rows="4" style="height:92px;" name="memory" placeholder="new comment..."&gt;&lt;/textarea&gt;</code></p>
  
  <p>JS:</p>
  
  <pre><code>&lt;script type="text/javascript"&gt;
    var textarea = document.getElementById("textarea1");
    var limit = 200;
  
  textarea.oninput = function() {
    textarea.style.height = "";
    textarea.style.height = Math.min(textarea.scrollHeight, limit) + "px";
  
    if(textarea.style.height == "92px"){
      textarea.style.overflow = "hidden";
    } else if(textarea.style.height &lt; limit  + "px"){
      textarea.style.overflow = "hidden";
    } else {
      textarea.style.overflow = "auto";
    }
  };
  &lt;/script&gt;
  </code></pre>
  
  <p>How do i do this?</p>