title: Dropdown menu choice hides fields through class
body: <p>I have a dropdown menu, that when a value is chosen it hides/ shows fields, because of the php code behind it I need to use class to choose it.</p>
  
  <p>I was also wondering if theres a way to add back the padding when hiding and showing the fields.</p>
  
  <p>I tried using "<code>document.getElementsByClassName("className");</code>" But couldn't get it working.</p>
  
  <p><strong>HTML:</strong></p>
  
  <pre><code>&lt;select id="form" onchange="ChangeDropdowns(this.value);"&gt;
      &lt;option value="hide"&gt;hide&lt;/option&gt;
      &lt;option value="show"&gt;show&lt;/option&gt;
  &lt;/select&gt;
  &lt;input type="text" id="testField" class="testField" /&gt;
  </code></pre>
  
  <p><strong>Javascript:</strong></p>
  
  <pre><code>function ChangeDropdowns(value) {
      if (value == "show") {
          document.getElementById('testField').style.display = 'none';
      } else if (value == "hide") {
          document.getElementById('testField').style.display = 'block';
      }
  }   
  </code></pre>