Get radio checked in an array in jquery(在 jquery 的数组中检查收音机)
本文介绍了在 jquery 的数组中检查收音机的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我得到了下一个 html 代码,我想得到选中的单选按钮数组:
I got the next html code and i want to get the array of checked radio buttons:
<tr>
<td>¿Cómo te llamas?</td>
<td><input class="radio" type="radio" name="respuesta1" value="female"> Pablo</td>
<td><input class="radio" type="radio" name="respuesta1" value="female"> Christian</td>
<td><input class="radio" type="radio" name="respuesta1" value="female"> Alberto</td>
</tr>
<tr>
<td>¿Cuánto es 2 + 2?</td>
<td><input class="radio" type="radio" name="respuesta2" value="female"> 2</td>
<td><input class="radio" type="radio" name="respuesta2" value="female"> 3</td>
<td><input class="radio" type="radio" name="respuesta2" value="female"> 4</td>
</tr>
如您所见,有两个问题,但我只想在 jquery 数组中获取已检查的收音机以获得正确答案.你能帮我么?
As you can see, there arte two questions but i want only get the checked radios in a jquery array for the correct answers. Can you please help me?
推荐答案
我觉得这可能行得通
$(".radio:checked").each(function() {
console.log($(this).val());
});
这篇关于在 jquery 的数组中检查收音机的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
沃梦达教程
本文标题为:在 jquery 的数组中检查收音机
基础教程推荐
猜你喜欢
- WatchKit 支持 html 吗?有没有像 UIWebview 这样的控制器? 2022-01-01
- 什么是不使用 jQuery 的经验技术原因? 2022-01-01
- Javascript 在多个元素上单击事件侦听器并获取目标 2022-01-01
- 为什么我在 Vue.js 中得到 ERR_CONNECTION_TIMED_OUT? 2022-01-01
- jQuery File Upload - 如何识别所有文件何时上传 2022-01-01
- Node.js 有没有好的索引/搜索引擎? 2022-01-01
- 如何使用 CSS 显示和隐藏 div? 2022-01-01
- 如何使用sencha Touch2在单页中显示列表和其他标签 2022-01-01
- 如何在特定日期之前获取消息? 2022-01-01
- 每次设置弹出窗口的焦点 2022-01-01
