I’m building a quiz app in which the correct option shows green background and the wrong asnwer gets a red backgroung. i created a className of correct with a green background and wrong with a red background in my css sheet this classes are added when the user click on an option thereby changing background color of the option selected. now i want the correct option to get a green background and the wrong option a red backgroung simultaneously when the user selects a wrong option. My if statement is below:
if(id[id.length-1]==this.questions[this.index].answer) {
this.score++;
ele.className=“correct”;
} else {
ele.className="wrong";
}