I have 2 radio buttons on my page:
<input id="rb1" type="radio" name="rmode" />
<input id="rb2" type="radio" name="rmode" />
How can I figure out which one was selected using jquery?
...
<input type="radio" name="sample" value="1" />
<input type="radio" name="sample" value="2" checked="checked" />
<input type="radio" name="sample" value="3" />
...
//javascript code
<script type="text/javascript">
<!--
// displays the selected radio button in an alert box
alert($('input[name=sample]:checked').val())
-->
</script>
This should return which radio buttons are currently checked:
var id = $("input[@name=rmode]:checked").attr('id');
More information here. Hope that helps!