jQuery:循环 HTML 表格内的所有单选按钮
我有一个 HTML 表,有 n 行,每行在 Row 中包含一个单选按钮。使用 jQuery,我如何查看这些单选按钮来检查哪一个被选中?
I have an HTML table having n rows and each rows contain one radiobutton in the Row.Using jQuery , How can i look thru these radio buttons to check which one is checked ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(8)
HTH。
HTH.
要循环遍历所有已选中的单选按钮,您还可以执行以下操作:
To loop through all the radio checked radio buttons, you can also do this:
有很多方法可以做到这一点,例如,使用
.each
和.is
遍历方法:There are many ways to do that, e.g., using
.each
and the.is
traversal method:http://api.jquery.com/checked-selector/
http://api.jquery.com/checked-selector/
您想要处理每个单选按钮还是只需要选中的单选按钮?如果是后者,则非常简单:
参考:
:radio
,:checked
Do you want to process every radio button or do you only need the checked ones? If the latter, it is quite easy:
Reference:
:radio
,:checked