使用 li class 名称获取单选按钮的值

Get value of radio button using li class name

这里我想获取输入类型单选按钮的值,我想使用 li class="gchoice_38_1"

检查输入类型单选按钮的属性是真还是假

所以我的问题是如何检查单选按钮是否被选中。

<li class="gchoice_38_1">
    <input type="radio" onclick="gf_apply_rules(29,[8,37,46]);" tabindex="4" id="choice_29_38_1" checked="checked" value="no" name="input_38">
    <label id="label_29_38_1" for="choice_29_38_1">no</label>
    </li>

试试这个:迭代 li 内具有 class="gchoice_38_1" 的所有单选按钮,使用 is(':checked') 查找选中状态

$('li.gchoice_38_1 input[type=radio]').each(function(){
   alert('Radio checked status : '+$(this).is(':checked'));
});

通过这个onclick="gf_apply_rules(this,29,[8,37,46])

function gf_apply_rules(elm,no,arr){

    alert(elm.checked);
}

DEMO

这就是我要做的:

$("input :radio[name=input_38]").click(function(){
 var val=$(this).val();
});