I am making an experiment that requires participants to make a judgement on a photograph. As a multiple choice question, they either press "F" for yes or "J" for no and after 10 seconds, the page moves onto the next photograph.
Though I am able to see whether they pressed "F" or "J", I am not able to see the time at which they pressed the key.
Is there something missing from the code? I'd really appreciate any help!
Qualtrics.SurveyEngine.addOnload(function()
{
this.hideNextButton();
this.hidePreviousButton();
var that = this;
Event.observe(document, 'keydown', function keydownCallback(e) {
var choiceID = null;
switch (e.keyCode) {
case 70: // 'F' was pressed
choiceID = 1;
break;
case 74: // 'J' was pressed
choiceID = 2;
break;
}
if (choiceID) {
Event.stopObserving(document, 'keydown', keydownCallback);
that.setChoiceValue(choiceID, true);
}
});
});
Be the first to reply!
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.