title: Toggle Checkbox using JavaScript
body: <p>I had this working, but I didnt save and cannot replicate. I am trying to toggle checkboxes using <code>if else</code>. What am I doing wrong. </p>
  
  <p>What I thought would work:</p>
  
  <pre><code>function myForm() {
      var inputs = document.getElementsByTagName("input");
      for(var i = 0; i &lt; inputs.length; i++) {
          if(inputs[i].type == "checkbox") { 
              if(inputs[i].checked = false) {
                  inputs[i].checked = true; 
              } else {
                  if(inputs[i].checked = true) {
                      inputs[i].checked = false; 
                  }   
              }
          }  
      } 
  }
  </code></pre>