title: Validating checkbox with javascript
body: <p>I have problem to validate multi checkbox , I want to check if the user has selected at least one checkbox. 
  Im try with document.getElementByClassName but does not work</p>
  
  <p>HTML:</p>
  
  <pre><code>&lt;form id="formupload" method="post" enctype="multipart/form-data" action="upload.php" name="formupload"&gt;
      &lt;input onKeydown="javascript:validateForm();" id="txtFileName" name="txtFileName" /&gt;
      &lt;input onKeydown="javascript:validateForm();" id="title" name="title" /&gt;
      &lt;input onKeydown="javascript:validateForm();" id="keywords" name="keywords" /&gt;
      &lt;input onKeydown="javascript:validateForm();" id="description" name="description" /&gt;
  
  
          &lt;span class="niche"&gt;
          &lt;input type="checkbox" value="1" name="channel[]" class="css-checkbox" id="box_1"&gt;
          &lt;label class="css-label" name="lbl_1" for="box_1"&gt;Amateur&lt;/label&gt;
          &lt;/span&gt;
  
          &lt;span class="niche"&gt;
          &lt;input type="checkbox" value="2" name="channel[]" class="css-checkbox" id="box_2"&gt;
          &lt;label class="css-label" name="lbl_2" for="box_2"&gt;Amateur&lt;/label&gt;
          &lt;/span&gt;
  
          &lt;span class="niche"&gt;
          &lt;input type="checkbox" value="3" name="channel[]" class="css-checkbox" id="box_3"&gt;
          &lt;label class="css-label" name="lbl_3" for="box_3"&gt;Amateur&lt;/label&gt;
          &lt;/span&gt;
  
  &lt;button id="btnSubmit" class="btn lbtn upBtn" type="submit"&gt;Upload&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>And Here is javascript:</p>
  
  <pre><code>function validateForm() {
      var txtFileName = document.getElementById("txtFileName");
      var titleTxt = document.getElementById("title");
      var tagsTxt = document.getElementById("keywords");
      var descTxt = document.getElementById("description");
  
      var isValid = true;
      if (txtFileName.value === "" || titleTxt.value === "" || tagsTxt.value === "" || descTxt.value === "" ) {
          isValid = false;
      }
  
      document.getElementById("btnSubmit").disabled = !isValid;
  
  }
  </code></pre>