Skip to content

Instantly share code, notes, and snippets.

@mattbloomfield
Created July 10, 2018 12:24
Show Gist options
  • Save mattbloomfield/e35b360fb259df583e17020abcec4ca9 to your computer and use it in GitHub Desktop.
Save mattbloomfield/e35b360fb259df583e17020abcec4ca9 to your computer and use it in GitHub Desktop.
Qualtrics.SurveyEngine.addOnload(function() {
var qid = this.questionId;
document.onkeydown = function(event) {
console.log('keydown',event);
if (event.which == 37) {
event.preventDefault();
Qualtrics.SurveyEngine.registry[qid].setChoiceValue(1, true);
jQuery('#NextButton').click();
} else if (event.which == 39) {
event.preventDefault();
Qualtrics.SurveyEngine.registry[qid].setChoiceValue(2, true);
jQuery('#NextButton').click();
}
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment