我正在使用单选按钮。jQuery:单选按钮多维数组
<input type="radio" value="1" name="report[1][AP]">
<input type="radio" value="2" name="report[1][AP]">
<input type="radio" value="1" name="report[1][DCI]">
<input type="radio" value="2" name="report[1][DCI]">
<input type="radio" value="1" name="report[2][AP]">
<input type="radio" value="2" name="report[2][AP]">
<input type="radio" value="1" name="report[2][DCI]">
<input type="radio" value="2" name="report[2][DCI]">
如果报告[1] [AP]被选中然后报告[1] [DCI]也需要检查,或如果报告[1] [DCI]被选中然后报告[1] [AP]也应该检查。
类似地;
如果报告[2] [AP]被选中,那么报告[2] [DCI]也应该被检查,或者如果报告[2] [DCI]被选中,那么报告[2] [AP]也应该被检查。
我该怎么办?请帮忙!
我使用这样的:
$('input[type="radio"]').on('click', function(){
var found = $(this).attr('name');
var founds = found.substring(0, found.indexOf(']'))+"]";
$("input[type="+founds+"]").prop('required',true);
});
错误:语法错误,不能识别的表达式:输入[类型= report_time [1]]
“也应该检查”...手段应该是“请求IRED”。必须检查。 –