title: How to hide a checkbox from django forms library and toggle its display attribute with Javascript
body: <p>I have been making a form in html that has a checkbox and if checked it displays another checkbox using Javascript. I have now changed that form to use django's Form library but I don't know how to access the display attribute of the django input fields. I have tried the HideInput widget but all that doesn't hide the label just the box itself. </p>
  
  <p>Any help on how to set the display attributes of django Form objects and/or how to toggle those attributes using Javascript would be great and/or how to code event attributes on django Forms would be great!</p>
  
  <p>models.py:</p>
  
  <pre><code>class ContactForm(forms.Form):
  Contact = forms.BooleanField(required=False, widget=CheckboxInput())
  More = forms.BooleanField(required=False, widget=CheckboxInput())
  </code></pre>
  
  <p>html page:</p>
  
  <pre><code> &lt;script type="text/javascript" src="http://code.jquery.com/jquery-1.8.0.min.js"&gt;&lt;/script&gt;
   &lt;script type="text/javascript"&gt; 
  
  
  
  
  $(function(){
  $('#id_Contact').click(function(){
   if($('#id_Contact').is(':checked')){
      $('#id_More').show();
   }
    });
  });
  
      function ifChecked(id, id2){
          var ele = document.getElementById(id);
          var ele2 = document.getElementById(id2);
  
          if(ele.checked){
              ele2.style.display = "block";
          }
          else{
              ele2.style.display = "none";
          }
      }
  &lt;/script&gt;
  
  &lt;form action="/contact/" method="post"&gt;
  {% for field in form %}
      &lt;div class="fieldWrapper"&gt;
          {{ field.errors }}
          {{ field.label_tag }}: {{ field }}
      &lt;/div&gt;
  {% endfor %}
  &lt;p&gt;&lt;input type="submit" value="Send message" /&gt;&lt;/p&gt;
  &lt;/form&gt;
  </code></pre>