Solved
Timing to first keypress in essay box
Hi,
I'm trying to add a timer to an essay question so that participants are timed until they start typing in the text box. I found some previous discussion asking about this, but they ultimately didn't have a conclusion. Probably some type of event viewer with a keydown and keyup, but I'm not sure how to code it.
Thanks.
Best answer by rondev
To get the total time in seconds after the first key is pressed in text box, use the below code.
Create an embedded data in survey flow before this essay question. Paste the below code in the JS (OnReady) of the essay question
var i = 0;
var isRecording = false;
var s;
jQuery("#"+this.questionId+" .InputText").on('keydown', function(){
if(!isRecording){
isRecording = true;
s = setInterval(function(){ i++;}, 1000);
}
});
jQuery("#NextButton").on('click',function(){
clearInterval(s);
Qualtrics.SurveyEngine.setEmbeddedData("TotalTime", i);
});
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
