For 30 Qualtrics pages, I'm using the code below (which I borrowed from here) to for each page:
- hide the "next" button
- give two choices to select from by using a "keystroke"
- once the choice is made, automatically go to the next page (where the same routine would be followed)
Qualtrics.SurveyEngine.addOnload(function()
{
$('Buttons').hide();
if(window.location.pathname.match(/^\/jfe[0-9]?\/preview/)) {
$(this.questionId).select('input').first().focus();
}
var that = this;
Event.observe(document, 'keydown', function keydownCallback(e) {
var choiceID = null;
switch (e.keyCode) {
case 74: // 'j' was pressed
choiceID = 1;
break;
case 75: // 'k' was pressed
choiceID = 2;
break;
}
if (choiceID) {
Event.stopObserving(document, 'keydown', keydownCallback);
that.setChoiceValue(choiceID, true);
$('NextButton').click();
}
});
});
To the best of my knowledge this code has been used by other users.
The problem however is that the "Next" button is hidden only on the first page. From the second page onward the "Next" button is always displayed although the rest of the code works fine.
Any idea where the problem is?
Best,