Hello,
I was wondering if there was a JavaScript solution available so that during a block with a 5 minute countdown (done with a timing question), each time the participant presses the ENTER key inside a text box within the page, the time of that key-press is recorded in some sort of embedded data variable.
It is specifically the script for recording the timing of each key-press that has me stumped. Any help on this issue would be greatly appreciated!
Page 1 / 1
https://community.qualtrics.com/XMcommunity/discussion/23754/way-to-log-timing-of-key-presses-during-a-timing-countdown-questionThis thread might help. You might need to update the code.
Do something like the following. It will record the times in milliseconds from when the page is ready:
Qualtrics.SurveyEngine.addOnReady(function() {
var start = new Date(), times = [];
jQuery("#"+this.questionId+" input[type=text]").keydown(function(ev) {
if(ev.key==='Enter') times.push(new Date() - start);
});
Qualtrics.SurveyEngine.addOnPageSubmit(function() {
Qualtrics.SurveyEngine.setEmbeddedData("times",times.join(","));
});
});
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.