Lexical Decision Task -Keypress Reaction Times to words and nonwords | XM Community
Skip to main content
Has anyone used javascript to present words from different lists and record reaction times and keypresses?

Basically, I want to create a standard LDT.



Thanks!
That's quite a demanding task so it is not possible for me personally to create one from scratch. I can share some resources with you, however.



1. PDF with different JS/HTML code snippets that can be handy when working w/ Qualtrics - https://psrc.princeton.edu/sites/psrc/files/html_tips_tricks.pdf

2. Code below for timestamping video play/pauses (you can use similar logic to record key presses/reaction times (from a community answer a while back):



`

Qualtrics.SurveyEngine.addOnload(function()



{



/*Place your JavaScript here to run when the page is unloaded*/



});

Qualtrics.SurveyEngine.addOnReady(function()

{

pauseTimestamp = null;

playTimestamp = null;



pauses = [];

plays = [];

playCount = 0;

pauseCount = 0;



jQuery("video").on('play', function() {

playCount++;

playTimestamp = Date.now();

if (pauseTimestamp) {

pauses.push(playTimestamp - pauseTimestamp);

}

Qualtrics.SurveyEngine.setEmbeddedData('playCount', playCount);

Qualtrics.SurveyEngine.setEmbeddedData('pauses', pauses.join(";"));

});



jQuery("video").on('pause', function() {

pauseCount++;

pauseTimestamp = Date.now();

plays.push(pauseTimestamp - playTimestamp);

Qualtrics.SurveyEngine.setEmbeddedData('pauseCount', pauseCount);

Qualtrics.SurveyEngine.setEmbeddedData('plays', plays.join(";"));

});



var s='';



jQuery("video").on('play', function() {



if(s==''){



s= Date.now();



Qualtrics.SurveyEngine.setEmbeddedData( 'Vid1Start', s);



}



});



var z='';



jQuery("video").on('pause', function() {



if(z==''){



z= Date.now();



Qualtrics.SurveyEngine.setEmbeddedData( 'Vid1Pause', z);



}



});

});



Qualtrics.SurveyEngine.addOnUnload(function()



{

if (playCount > pauseCount) {

plays.push(Date.now() - playTimestamp);

Qualtrics.SurveyEngine.setEmbeddedData('plays', plays.join(";"));

} else if (pauseCount) {

pauses.push(Date.now() - pauseTimestamp);

Qualtrics.SurveyEngine.setEmbeddedData('pauses', pauses.join(";"));

}

});`



3. Published paper on how to determine if subjects are on task (can use certain parts to construct your task as well as to generally introduce greater experimental control) - https://journals.sagepub.com/doi/pdf/10.1177/2515245919838479



If you have a highly specific problem and can produce a minimal, reproducible example of your issue, then it would be better to share that with the community as the breadth of your question makes it difficult to provide more substantial help than that.



Good luck!

have you figured out how to conduct lexical decision task in the qualtrics?


Leave a Reply