js实现获取选中checkbox的值 - 婧星

时间:2024-02-16 13:45:16

js实现获取选中checkbox的值

var bookVersionId = [];
   var examVirtualSetResultId;
   $.each($(\'input[type=checkbox]:checked\'),function(i,itesm){
    examVirtualSetResultId = $(itesm).attr(\'data-type\');
    var examResultIds = $(itesm).attr(\'data-typeid\');
    var userCode = $(itesm).attr(\'data-code\');
    var examResultIdObj = new Object();//创建对象
    examResultIdObj.examResultId = examResultIds;
    examResultIdObj.userCode = userCode;
    console.log(examResultIdObj);
    bookVersionId.push(examResultIdObj);//把对象push到数组中
    console.log(bookVersionId);
   });
   //传参数
   obj.examVirtualSetResultId = examVirtualSetResultId;
   console.log(examVirtualSetResultId);
   obj.studentExamSummaries = bookVersionId;
   getDeatil(obj);
获取选中checked的值