var answer = $('.sub-answer') var right = $('.right') for(var i=0;i<answer.length;i++){ //console.info(answer) var sel = $(right).text(); $(answer).children("dd[data-value='"+sel+"']").addClass("cho-this"); $('#answer_'+i).val(sel) }
//填空题
var answerCom = $('.e__textarea') var rightCom = $('.wenzi') var j=0 for(var i=0;i<answerCom.length;i++){ //console.info(answerCom) var sel = $(rightCom[j]).text(); j = j+2; $(answerCom).val(sel) }