I have an array
var list= ['A','B','C'], answer=[];
the user will be slecting answers and that will update the answer array.
She/He will be selecting buttons to match up to the list array, and using this
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>";
}
}
}
So say the person chooses A, D, C, then it will say incorrect, you answered A D C ... etc
What I want to happen is for A and C, which are two correct responses, to be changed to red font and for D to remain black since it is incorrect.
How do I add a class to this?