我的页面上有 2 个单选按钮:
<input id="rb1" type="radio" name="rmode" />
<input id="rb2" type="radio" name="rmode" />
如何确定使用 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>
关于jquery - 如何确定选择了哪个单选按钮?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/4865309/