如下html代码:

<input id="rad" name="rad" type="radio" value="1"/>
<input id="rad" name="rad" type="radio" value="2"/>
<input id="rad" name="rad" type="radio" value="3"/>

使用jquery可以很方便的获取到同一组的radio选中的value值

<script src="js/jquery-1.3.2.js"></script> 
<script type="text/javascript">
function doit(){
alert($(
"input[name='rad']:checked").val());
}
</script>

<input id="rad" name="rad" type="radio" value="1"/>
<input id="rad" name="rad" type="radio" value="2"/>
<input id="rad" name="rad" type="radio" value="3"/>
<input type="button" onclick="doit()" value="click">




相关文章:

  • 2021-11-10
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-03
  • 2022-01-07
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-02-26
  • 2021-12-07
相关资源
相似解决方案