Okay so I have code that sort of works---it is counting correct answers, but it is not exiting the survey when the criterion is hit (3). Does anyone know what is wrong with my code?
Qualtrics.SurveyEngine.addOnload(function() {
var isCorrect = 4;
var currentCorrectAnswers = Qualtrics.SurveyEngine.getEmbeddedData("CorrectAnswers");
if (!currentCorrectAnswers) {
currentCorrectAnswers = 0;
}
// If it's correct, increment CorrectAnswers
if (isCorrect) {
currentCorrectAnswers++;
Qualtrics.SurveyEngine.setEmbeddedData("CorrectAnswers", currentCorrectAnswers.toString());
}
if (currentCorrectAnswers >= 3) {
Qualtrics.SurveyEngine.quit();
}
});