title: Javascript conditional - uncheck radio buttons in hidden div?
body: <p>I'm trying to set up a conditional type radio button for a form, I actually modified some javascript I found here that looks like this:</p>
  
  <pre><code>function hideStuff(id) {
      document.getElementById('flatDiv').style.display = 'none';
      document.getElementById('salaryDiv').style.display = 'none';
  }
  
  function checkType(selectedType) {
  
      if (selectedType == 'flat') {
          document.getElementById('flatDiv').style.display = 'block';
          document.getElementById('salaryDiv').style.display = 'none';
      } else {
          document.getElementById('flatDiv').style.display = 'none';
          document.getElementById('salaryDiv').style.display = 'block';
      }
  }
  </code></pre>
  
  <p>and the html is like this:</p>
  
  <pre><code>&lt;input type="radio" name="Type" value="flat" onclick="checkType(this.value)" /&gt;Flat
  &lt;input type="radio" name="Type" value="salary" onclick="checkType(this.value)" /&gt;Salaray
  &lt;br /&gt;
  &lt;div id="salaryDiv" style="display:none;"&gt;Choose an option:
      &lt;input type="radio" name="salaryType" value="1x" /&gt;1x
      &lt;input type="radio" name="salaryType" value="2x" /&gt;2x
      &lt;input type="radio" name="salaryType" value="3x" /&gt;3x&lt;/div&gt;
  &lt;div id="flatDiv" style="display:none;"&gt;Choose an option:
      &lt;input type="radio" name="flatType" value="$25,000" /&gt;$25,000
      &lt;input type="radio" name="flatType" value="$50,000" /&gt;$50,000&lt;/div&gt;
  </code></pre>
  
  <p><a href="http://jsfiddle.net/Cwalkdawg/Ncfz5/1/" rel="nofollow">jsFiddle</a></p>
  
  <p>That all works, but if someone clicks Salary and chooses an option and then changes their mind, when they click Flat I'd like to clear any selection they've previously made under Salary (and vice versa) I've tried a couple things that don't work, so I thought I'd ask someone who knows what they're doing. Thanks.</p>