title: Javascript checkbox checking
body: <p>I would like to use Javascript to check if a checkbox has been checked and if the checkbox is not check, the submission form would not continue until it is checked. Below are my codes.</p>
  
  <pre><code>&lt;SCRIPT language=javascript&gt;
  function checkAcknowledgement(checkbox){
      alert(checkbox.toString());
      if (checkbox.checked == false){
          alert('Please read through the acknowledgement and acknowledge it.');
          return false;
      } else {
          return true;
      }
  }
  &lt;/script&gt;
  
  &lt;form action="ioutput.php" method="POST"&gt;
      &lt;input name="form" type="hidden" id="form" value="true"&gt;
      ... some html form ...
      &lt;input type="checkbox" id="acknowledgement" value="1" /&gt;&lt;br&gt;&lt;br&gt;
      &lt;input type="submit" value="submit" onclick="return checkAcknowledgement(this)"/&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>Whenever the form is checked or not, it returns the alert warning that the form have not been checked despite me checking it manually. How should I fix it ?</p>