html代码:

<input id="rad1" name="rad" type="radio" value="1"/>
<input id="rad2" name="rad" type="radio" value="2"/>
<input id="rad3" 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="rad1" name="rad" type="radio" value="1"/> 
<input id="rad2" name="rad" type="radio" value="2"/> 
<input id="rad3" name="rad" type="radio" value="3"/> 
<input type="button" onclick="doit()" value="click">

转自:http://blog.163.com/gis_warrior/blog/static/19361717320136301754294

 

相关文章:

  • 2021-09-02
  • 2022-01-03
  • 2022-12-23
  • 2022-01-06
  • 2021-10-09
  • 2022-12-23
  • 2021-11-21
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-31
  • 2021-11-28
  • 2022-12-23
  • 2021-11-17
相关资源
相似解决方案