如何获取已选中的单选按钮的值,jquery
我们能否获取单选按钮的值,仅获取那些已选中的值, 因为我必须实现一个有很多单选按钮的表单,所以我怎样才能获取所有已检查的值 我要做的是
我有13门科目,比如:物理、数学、生物...... 学生可以选择任意数量的科目,每个科目都有两个单选按钮,一个是 A,另一个是 As,
那么我如何获取已选中的单选按钮的值? 使用jquery
can we get the values of the radio buttons , only those which has been checked ,
cause i have to implement a form in which there are many radio buttons , so how can i get all the values which has been checked
what i have to do is
i have 13 subjects like : physics , math , biology .....
and the students can choose any number of subjects , and each subject will have two radio buttons one is A and the another is As ,
so how can i get the values of the radio buttons which has been checked?
using jquery
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这将循环遍历文档中已检查的所有单选元素:
如果您想获取特定单选组的检查值,您可以这样做:
因此,如果您的 HTML 如下所示:
value
将是 2This would loop through all the radio elements in the document that have been checked:
If you wanted to get the checked value of a particular radio group, you would do:
So if your HTML was like this:
value
would be 2