title: Toggle visibility of form fields if radio button is selected
body: <p>I'm trying to hide a set of form fields initially. Then if a radio button is selected, show that group of fields. Then if that radio is deselected, hide them again.</p>
  
  <p>The first two are working fine (hide fields initially, show them if radio is selected). But I can't get them to hide again when the radio is deselected. I'm sure I'm missing something obvious but I can't figure out what it is.</p>
  
  <p><a href="http://jsfiddle.net/C5PMy/" rel="nofollow">http://jsfiddle.net/C5PMy/</a></p>
  
  <pre><code>$(document).ready(function() {
  
  toggleFields(); //call this first so we start out with the correct visibility depending on the selected form values
  
      //Hide the fields initially
      $("#bsd-field-custom-105966-group").hide();
      $("#bsd-field-custom-105967-group").hide();
      $("#bsd-field-custom-105968-group").hide();
      $("#bsd-field-custom-105978").hide();
      $("#bsd-field-custom-105969-group").hide();
      $("#bsd-field-custom-105970").hide();
      $("#bsd-field-custom-105979").hide();
      $("#bsd-field-custom-105971-group").hide();
      $("#bsd-field-custom-105972").hide(); 
  
  
  //Show the fields only if lodging is required
         $("#custom-105965_0").change(function () {
      toggleFields();
  });
  
  
  });
  //this toggles the visibility of the other lodging fields depending on the current     selected value of the "lodging required" field
  function toggleFields() {
  if ($(("#custom-105965_0").checked)) {
  
      $("#bsd-field-custom-105966-group").show();
      $("#bsd-field-custom-105967-group").show();
      $("#bsd-field-custom-105968-group").show();
      $("#bsd-field-custom-105978").show();
      $("#bsd-field-custom-105969-group").show();
      $("#bsd-field-custom-105970").show();
      $("#bsd-field-custom-105979").show();
      $("#bsd-field-custom-105971-group").show();
      $("#bsd-field-custom-105972").show();
              }
  
              else  {
      $("#bsd-field-custom-105966-group").hide();
      $("#bsd-field-custom-105967-group").hide();
      $("#bsd-field-custom-105968-group").hide();
      $("#bsd-field-custom-105978").hide();
      $("#bsd-field-custom-105969-group").hide();
      $("#bsd-field-custom-105970").hide();
      $("#bsd-field-custom-105979").hide();
      $("#bsd-field-custom-105971-group").hide();
      $("#bsd-field-custom-105972").hide();
              }
      }
  </code></pre>