Newbie needing help!

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 :slight_smile:

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

what is $(“correctAnswer”)? is this a class? id? if it’s a class you have to add a “dot”, if it’s an id you need to add “#”, otherwise you are trying to select it as HTML element.

Hi @Janatbek!

Thank you for your response!

The OP has not been active on the forum since this post was made almost a year ago so I am going to close this topic.

Thanks!