title: Create Checkbox with Javascript
body: <p>I am trying to create a checkbox with javascript when a button is clicked.  I am really struggling, I have searched the net for help and this is the closest I've got but it does not work.</p>
  
  <p>What have I done wrong?</p>
  
  <pre><code>&lt;p&gt;Click the buttons to create a Checkbox.&lt;/p&gt;
  
  &lt;button onclick="addCheckBox()"&gt;Create a button&lt;/button&gt;
  &lt;input id="check" name="checkBoxes"&gt;
  &lt;script&gt;
  function addCheckBox() {
  
      var ColorsAvailable = document.getElementById('checkBoxes');
      var check_value = new Array( )
      check_value[0] = "Yellow"
      check_value[1] = "Red"
      check_value[2] = "Green"
  
  
     for(var count in check_value)
      {
        var color=document.createElement("input");   
        color.value=(check_value[count] + '&lt;/br&gt;');
        color.type="checkbox";
        color.id="color" + count;
        ColorsAvailable.appendChild(color);
     }
  }
  
  &lt;/script&gt;
  </code></pre>