[英]Client code: Finding which radio button is checked
在浏览器的 Javascript 代码中,给定一组单选按钮的name
,有没有办法直接找出哪个按钮被选中,而不用逐个遍历每个按钮来检查其已checked
属性?
Yes with jQuery.是的 jQuery。 If the name of the group is
state
, then:如果组的名称是
state
,则:
$("[name=state]:checked").val()
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.