title: Check which radio button is checked
body: <p>----EDIT----</p>
  
  <p>I am making an jquery mobile application. Now I want to check which radiobutton is checked.</p>
  
  <p>This is what I do in my javascript.</p>
  
  <pre><code>function filter(){
      if(document.getElementById('segment1').checked) {
           alert('Iedereen');
      }else if(document.getElementById('segment2').checked) {
           alert('team');
      }else{
          alert('favorieten');
      }
  }
  </code></pre>
  
  <p>En this is my HTML</p>
  
  <pre><code>&lt;div data-role="fieldcontain"&gt;
  &lt;fieldset data-role="controlgroup" data-type="horizontal" onchange=filter() &gt; 
      &lt;input type="radio" name="radio-view"  data-icon="segment-titlestyle-segonly"  id="segment1" value="choice1" checked="checked"/&gt; 
      &lt;label for="segment1"  id="controls"&gt;
      &lt;span class="ui-btn-text-controls"&gt;Iedereen&lt;/span&gt;
      &lt;/label&gt; 
      &lt;input type="radio" name="radio-view" data-icon="segment-titlestyle-segonly" id="segment2" value="choice2" /&gt; 
      &lt;label for="segment2" id="controls"&gt;
      &lt;span class="ui-btn-text-controls"&gt;Team&lt;/span&gt;
      &lt;/label&gt; 
      &lt;input type="radio" name="radio-view" data-icon="segment-titlestyle-segonly" id="segment3" value="choice3" /&gt; 
      &lt;label for="segment3" id="controls"&gt;
      &lt;span class="ui-btn-text-controls"&gt;Favorieten&lt;/span&gt;
      &lt;/label&gt;  
  &lt;/fieldset&gt;
  </code></pre>
  
  <p>For some reason it doesn't work. Can anybody help?</p>
  
  <p>kind regards.</p>