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