& lt; C: forEach items="${requestScope. List}" var="list" varStatus="status" & gt;
This is judgment after jquery click li li child elements of the radio to checked
$(". Lileft "). Click (function () {
//$(this). The CSS (" the font - weight ", "bolder");
Var l=$(this). Attr (" name ");
Var lid=$(this). Attr (" id ");
If ($(this). HasClass (" green ")) {
$(this). RemoveClass (" green ");
$(" # "+ l +" "). RemoveClass (" childiv ");
$(this). The find (' input [type="radio"] "). The attr (" checked ", false);
} else {
$(" # "+ l +" "). The addClass (" childiv ");
$(this). AddClass (" green "). The siblings (). RemoveClass (" green ");
$(". Lileft "). The find (' input [id="radio"] "). The attr (" checked ", "checked");
}
This is for the selected radio array;
$(" # submit "). Click (function () {
var sum=0;
Var array1=[];
Var array2=[];
$(" ol ".) each (function () {
Array1. Push ($(this). The children (). Eq. (1) data (" answer "));
});
$(' input [name="radioq"] : checked '). Each (function () {
Array2. Push ($(' input [name="radioq"] : checked '). The val ());
});
for(var i=0; iIf (array1==array2 [I] [I]) {
The sum +=2;
}
}
Alert (sum + "");
Alert (array1. Length);
Alert (array2. Length);//this is for selected radio array length=_=! Can only get a
})
CodePudding user response:
14 lines of the input/id="radioq" should be a name="radioq"CodePudding user response:
Label write wrong, written in form form their click submit for a form name values can ultimately value corresponding to the same radio name=XXX, don't mind refresh the page directly submit can also form,