title: Clear all field inputs in div on hide() jquery: radio button with php function call
body: <p>I'm quite new to jQuery, so I'm having trouble with this.</p>
  
  <p>I have divs that show or hide according to which radio button is selected, but I cannot figure out how to make all of the fields reset if a div is hidden.</p>
  
  <p>The divs have date input fields with php drop down menus that are set to Null or "" in the first option.
  There are also some additional radio buttons within the main toggled divs (with more date choices/menus) - So a div within a div with more radio buttons...</p>
  
  <p>Ultimately, I want to clear/reset everything within any hidden divs.</p>
  
  <p>Here is my Jquery (I was getting desperate towards the end and started looking for straight up javascript after a while - don't know what I'm doing there either).</p>
  
  <p>The .desc class is the main radio button choice that shows or hides one of two divs with various other choices.</p>
  
  <pre><code>    $(document).ready(function(){ 
      $("input[name='date']").change(function() {
          var test = $(this).val();
          $(".desc").hide();
          $("#"+test).show();
          $("input[type='hidden']").remove();
      }); 
  
      $("input[name='year']").change(function() {
          var test = $(this).val();
          $(".rnge").hide();
          $("#"+test).show();
          $("input[type='hidden']").remove();
      }); 
  });
  </code></pre>
  
  <p>Here is the html (sorry for not adding it sooner.</p>
  
  <pre><code>&lt;div id="formElementLeft"&gt;
      &lt;h4&gt;Date:&lt;/h4&gt;
  &lt;p&gt;Is this an exact or an approximate date?&lt;/p&gt; 
      &lt;p&gt;&lt;input type="radio" name="date" value="exact"/&gt;Exact&lt;/p&gt;
      &lt;p&gt;&lt;input type="radio" name="date" value="circa"/&gt;Approximate&lt;/p&gt;   
  &lt;/div&gt;       
      &lt;!--if exact show this--&gt;
  &lt;div id="exact" class="desc" style="display:none;"&gt;
  &lt;p&gt;Enter the exact date: &lt;? echo date_picker(); ?&gt;&lt;input type="radio" name="bce_ce"   value="BCE"/&gt;BCE  &lt;input type="radio" name="bce_ce" value="CE"/&gt;CE&lt;/p&gt;        
  &lt;/div&gt;
      &lt;!--if approximate show this--&gt;
  &lt;div id="circa" class="desc" style="display:none;"&gt;
      &lt;p&gt;Enter a date range.&lt;/p&gt;             
      &lt;p&gt;is this a single year or a range of years?
      &lt;p&gt;&lt;input type="radio" name="year" value="single"/&gt;Single year&lt;/p&gt;
      &lt;p&gt;&lt;input type="radio" name="year" value="range"/&gt;Range of years&lt;/p&gt;        
      &lt;div id="single" class="rnge" style="display:none;"&gt;
      &lt;p&gt;&lt;? echo year_picker(); ?&gt;&lt;/p&gt;
      &lt;p&gt;&lt;? echo month_picker(); ?&gt; (optional)&lt;/p&gt;&lt;/div&gt;
      &lt;div id="range" class="rnge" style="display:none;"&gt;
      &lt;p&gt;Between &lt;? echo year_picker(); ?&gt;&lt;input type="radio" name="bce_ce" value="BCE"/&gt;BCE     &lt;input type="radio" name="bce_ce" value="CE"/&gt;CE;&lt;/p&gt; 
      &lt;p&gt;and &lt;? echo year_picker(); ?&gt;&lt;input type="radio" name="bce_ce" value="BCE"/&gt;BCE  &lt;input type="radio" name="bce_ce" value="CE"/&gt;CE&lt;/p&gt;&lt;/div&gt;               
  &lt;/div&gt;
  </code></pre>
  
  <p>Thanks in advance for helping poor, confused me.</p>