本文介绍了获取某些类的选定单选按钮的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在尝试获取具有所选类别的单选按钮。
I'm trying to get the radio buttons that has a certain class that is selected.
获取该类的单选按钮附带
Getting the radio buttons of that class comes with
$("input:radio.someClass");
我认为这样可以获得所选的单选按钮 -
I thought that this would work to get the selected radio button -
$("input:radio.someClass:selected");
但是返回空 - 我做错了什么?
But that returns empty - what am I doing wrong?
推荐答案
根据JQuery文档。
According to JQuery documentation.
:selected
选择器适用于选项元素。它不适用于复选框或无线电输入;
The :selected
selector works for option elements. It does not work for checkboxes or radio inputs;
尝试:
$("input:radio.someClass:checked");
这篇关于获取某些类的选定单选按钮的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!