I would like to present a typical multiple choice question, but allow participants to complete it in either the typical fashion (select a response then click continue) or by pressing a specific key (right bracket), at which point the question will auto-forward to the next question. I am able to do this with the following added to Qualtrics.SurveyEngine.addOnReady:
/* Allow right bracket to auto-advance this question. */
var that = this;
Event.observe(document, 'keydown', function keydownCallback(e){
var choiceID = null;
if (e.keyCode == 221)
{
Qualtrics.SurveyEngine.setEmbeddedData( 'PassAttChk', 1 );
Event.stopObserving(document, 'keydown', keydownCallback);
that.clickNextButton();
}
This actually works okay, but the problem is that it continues to catch the keypress in subsequent questions. I've tried adding this to Qualtrics.SurveyEngine.addOnUnload
Event.observe(document, 'keydown', function keydownCallback(e){ });
But it either does not function or stops the initial keypress from being caught.
Any idea what I'm doing wrong here? Thanks!!
Javascript for keypress within multiple choice question
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
