jQuery 和单选按钮组
在 jQuery 中,我想选择所有未选中按钮的单选按钮组。
或者,有没有一种方法可以选择所有单选按钮组并迭代这些组?
我动态地将 N 个单选按钮组添加到页面,并且事先不知道单选按钮组的名称是什么。
In jQuery, I'd like to select all groups of radio buttons where there are no buttons checked.
Or, is there a way in which I can select all radio button groups and iterate through the groups?
I'm dynamically adding N radio button groups to a page and will not know, before hand, what the names of the radio button groups will be.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
查找所有单选按钮组:
查找哪个单选按钮组已选中单选框,哪些未选中:
To find all radio groups:
to find which radio group has checked radio boxes and which hasn't:
支持多组和预检查。
```
证明: http://jsfiddle.net/abrkn/PGW2Z/
Support for multiple groups and pre-checked.
```
Proof: http://jsfiddle.net/abrkn/PGW2Z/
要按组名称选择所有无线电并仅获取不同名称的列表:
示例片段:
获得不同的组名称后,可以循环使用它们。
To select all radio by group name and obtain only the list of different names:
An example snippet:
After getting the different group names it's possible to cycle on them.