I am doing a exercise but cant solve the last bit.
I want to add a class to all my “correct answeres” and then style it, but it doesnt work.
What am i doing wrong? Please help
Edit: The part marked with ** is the part I am having trouble with.
//Knapp
$("#btn").click(function() {
var score = 0;
var answers = $('input[value="correct"]');
for (var answer of answers) {
if (answer.checked == true) {
score += 1;
} else {
}
}
alert("Du fick " + score + " poäng av " + answers.length + " möjliga ");
**$("correctAnswer").addClass("correct_answer_green");**
** $(".correct_answer_green").css("color", "green");**
}); //slut på kapp-funktion