Hello guys I have a problem with my checkRight() function. I tried to build a quiz webpage with js. Here is my complete code: https://www.codeply.com/go/qoCnPUDDxG My questions consists of a class with: question (string), answers(array of strings) and answer (string) attributes. If I click on the right answers my counters go very confusing up.
function checkRight (){
$(".answer").click(function() {
check = $(this).html();
if(check===qAry[i].rightAnswer){
rightCounter++;
$(".richtigZaehler").text(rightCounter);
i++;
askQ();
}
else if(check!=qAry[i].rightAnswer){
console.log("Update");
wrongCounter++;
$(".falschZaehler").text(wrongCounter);
}
});
}
Aucun commentaire:
Enregistrer un commentaire