I have a survey of multiple choice questions in which participants can select two answer options using the left and right arrow keys, which then submits the page. Currently the code I'm using is this excellent example (also copied below for clarity).
It's working well, but what I want it to do is to visibly select (i.e. make the usual choice selection circle appear next to the answer) the participants' choice before it submits the page, so they can see which one they chose. Currently, while the choice is recorded on the back end, the question advances without a visual indication of the choice.
Is this possible? I'm a Javascript newbie, so I've been playing around with focus etc without much success
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(); } }
});
How to select answer options using arrow keys?
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.

Practically, this is one 'block', with a question with the participant image and a multiple choice question with two (horizontal) options. I'd like participants to be able to select either of the options with the left or right arrow keys, and for it to look like this for a second or so (in this example, after pressing the right arrow key):
Before the page is submitted automatically.