Hi everyone,
I'm new on this forum.
I'm here because i try to record the number of time a participant press a key when a text is displayed on the screen. So i try to adapt a script i fund here to build this function (my only training in programmation is a 20 hours tuto on openclassroom...). I add the script in the question (in fact in the descriptive text). Here is my attempt :
Qualtrics.SurveyEngine.addOnReady(function() {
let questionId = "NumberOfPushG" ;
document.onkeydown = function(event) {
let i = 0
if (event.which == 71){
event.preventDefault();
i += 1
Qualtrics.SurveyEngine.registry[questionId].setChoiceValue(i);
}
}
});
Of course it doesn't work i would not be here otherwise...
What am i doing wrong ?
Thank you in advance to everyone.
Best answer by TomG
View original