title: enable/disable input fields with checkboxes (javascript)
body: <p>I'm trying to make a html5 form with different input fields, with a checkbox that can enable/disable input fields.</p>
  
  <p>When the checkbox is selected, it should be possible to enter data into an input field. When the checkbox isn't selected, it shouldn't be possible to enter data to the input field.</p>
  
  <p>I already tried this (just to try if enabling/disabling works):</p>
  
  <pre><code>&lt;script&gt;
  document.getElementById("checkbox").onclick = function() {
      document.getElementById("inputfield").disabled=true;
  }
  &lt;/script&gt;
  </code></pre>
  
  <p>The input field is disabled when the user clicks on the checkbox, so disabling fields works but I don't know how it works with selecting the checkbox and re-enabling.</p>
  
  <p>This is my first time using javascript so any help is greatly appreciated!</p>