我有一个数组
变量列表= ['A','B','C'], 答案=[];
用户将选择答案,这将更新答案数组。
她/他将选择按钮以匹配列表数组,并使用此
function response(){
var allcorrect = 1;
$.each( list, function( index , value ){
if( value === answer[ index ] ) {
console.log( 'Yes', response[ index ] );
} else{
console.log( 'No', response[ index ] );
allcorrect=0;
}
});
if (allcorrect==1){
text = "<p> Correct! You answered: " + response[0] + " and " + response[1] + " and " + response[2]+ "</p> <p> The correct response is A, B, C</p>";
}
else {
if (allcorrect==0){
text = "<p> Inorrect. You answered: " + response[0] + " and " + response[1] + " and " + response[2]+ "</p> <p> The correct response is supposed to be A, B, C</p>";
}
}
}
所以说这个人选择A,D,C,然后它会说不正确,你回答ADC ...等
我想要发生的是 A 和 C,这是两个正确的响应,将其更改为红色字体,并且 D 保持黑色,因为它不正确。
如何为此添加课程?